473,387 Members | 1,611 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

PDFWriter and VB

Does anyone have an example of using PDFWriter (4.0 or later) from VB or VBA
code?

Specifically, how to use Adobe's PDFDocInfo when calling the Window Printer
Escape API to name to document and prevent the dialog box from displaying.

Thanks in advance. Please e-mail sample code to me.

Ray Woerner
(rp****@netzero.net)

Nov 13 '05 #1
2 2498
You know, it would have been shorter to do a search in google and get your
answer immediately. It is very documented.
http://groups.google.com/groups?q=PD...TF-8&scoring=d

"Ray Woerner" <rp****@netzero.net> wrote in message
news:ag*****************@sam.nntpserver.com...
Does anyone have an example of using PDFWriter (4.0 or later) from VB or VBA code?

Specifically, how to use Adobe's PDFDocInfo when calling the Window Printer Escape API to name to document and prevent the dialog box from displaying.

Thanks in advance. Please e-mail sample code to me.

Ray Woerner
(rp****@netzero.net)

Nov 13 '05 #2
Hi,

i tried to manipulate the windows registry to print automaticly, but
it doesn't work fine.

CODE

Const HKEY_CURRENT_USER = &H80000001
Const KEY_ALL_ACCESS = &H3F
Const REG_SZ = (1)

Const VER_PLATFORM_WIN32_S = 0
Const VER_PLATFORM_WIN32_WINDOWS = 1 ' Windows 9x
Const VER_PLATFORM_WIN32_NT = 2 ' Windows NT or 2000

Private Type OSVERSIONINFO
dwOSVersionInfoSize As Long
dwMajorVersion As Long
dwMinorVersion As Long
dwBuildNumber As Long
dwPlatformId As Long
szCSDVersion As String * 128 ' "Service Pack xx"
End Type

Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As
Long) As Long

Private Declare Function WritePrivateProfileString Lib "kernel32"
Alias _
"WritePrivateProfileStringA" (ByVal lpApplicationName As String, _
ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As
String) As Long

Private Declare Function RegDeleteValue Lib "advapi32.dll" Alias
"RegDeleteValueA" _
(ByVal hKey As Long, ByVal lpValueName As String) As Long

Private Declare Function RegSetValueEx Lib "advapi32" Alias
"RegSetValueExA" _
(ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As
Long, _
ByVal dwType As Long, ByVal szData As String, ByVal cbData As Long)
As Long

Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias _
"RegOpenKeyExA" (ByVal hKey As Long, _
ByVal lpSubKey As String, ByVal ulOptions As Long, _
ByVal samDesired As Long, phkResult As Long) As Long

Private Declare Function GetVersionEx Lib "kernel32" Alias
"GetVersionExA" _
(lpVersionInformation As OSVERSIONINFO) As Long


lResult = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Adobe\Acrobat
PDFWriter", 0, KEY_ALL_ACCESS, phKey)

lResult = RegSetValueEx(phKey, "PDFFileName", 0, REG_SZ, p_filename,
CLng(Len(p_filename)))
bRes = WritePrivateProfileString("Acrobat PDFWriter", "PDFFileName",
p_filename, "c:\windows\system\pdfwritr.ini")

Application.PrintOut FileName:="", Range:=wdPrintAllDocument,
Item:= _
wdPrintDocumentContent, Copies:=1, Pages:="",
PageType:=wdPrintAllPages, _
Collate:=True, Background:=False, PrintToFile:=False,
PrintZoomColumn:=0, _
PrintZoomRow:=0, PrintZoomPaperWidth:=0,
PrintZoomPaperHeight:=0
lResult = RegDeleteValue(phKey, "PDFFileName")
lResult = RegCloseKey(phKey)
Nov 13 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael Harris | last post by:
Access XP WinXP Adobe Acrobat 5.0 I'm playing with Keri Hardwick's "Save a report's output as a PDF file" and most of it still works. The problem is the ChangePdfFileName is not changing the...
5
by: Randy Harris | last post by:
I'm finding working with PrtDevMode a nightmare. Is there any particular reason that Microsoft didn't simply provide a PrinterName argument for printing a report? That seems like a pretty...
15
by: Mark C | last post by:
All, I have exhaustingly been looking through the newsgroups in search of a way to systemically output an Access 97 report to a pdf file using the full version of Adobe Acrobat. I want the user...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
0
by: musicloverlch | last post by:
I used to be able to create PDFs, automatically save them to a file, and mail them out to people. This was on Access 97 with Windows NT. We've changed to Windows XP and Access 2003. Doesn't work...
4
by: William LaMartin | last post by:
I have a vb.net win form where I want to output some text to a printer. Everything works fine when printing to my laser or inkjet printers. However when I print to the Acrobat PDFWriter printer...
0
by: Wayne Deleersnyder | last post by:
I've been looking on the web trying to find a solution to converting a PDF Form from v.1.6(Acrobat 7) to PDF v1.4(Acrobat 5). It's one of those weird situations where one of the applications I'm...
1
by: He11razor | last post by:
Is there a way to interact with the PDFWriter though Javascript? I can invoke the "Print Dialogue" box, but from then on, it's up to the user to select the PDFWriter printer and enter the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.