Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print to pdf 2

Status
Not open for further replies.

petermeachem

Programmer
Aug 26, 2000
2,270
0
0
GB
I have a text editor written using txtextcontrol from the imaging source. What I want to do is to save the current document as a pdf and mail it back to the originator for approval. I could use acrobat writer except that it brings up a couple of dialog boxes that need OK clicking and I want to make this automatic.

Does anyone know of a way to do this simple thing? I've looked without success for an ocx or dll. Adobe do an sdk, but that's a 20Mb download. Must be easier than that surely?

Peter Meachem
 
What OK dialogs are you getting with Acrobat's PDFWriter? If it is a dialog for the path of the file, this can be written to the registry to bypass. Let me know if you want more info.
 
I get one to select a file name and then another to put in some spurious document information.

I would love to have info on how to get round these two. I think a lot of other people would too.

Thanks in advance. Peter Meachem
peter@accuflight.com
 
I found out what was up with 5d and jaws. 5d used to do a pdf creator which was taken over by jaws who now charge for it. I think it used to be niknak, which I seem to remember was also a freeby. Peter Meachem
peter@accuflight.com
 
This is how I bypassed the file name dialog.

1. Set your default printer to the Acrobat PDFWriter (use the printers collection).

2. Call this procedure passing the path of the file.

Public Sub PrintToPDFWriter(strFilePath As String)

Dim hregkey As Long
Dim secattr As SECURITY_ATTRIBUTES
Dim subkey As String
Dim neworused As Long
Dim stringbuffer As String
Dim retval As Long

subkey = "Software\Adobe\Acrobat PDFWriter"
secattr.nLength = Len(secattr)
secattr.lpSecurityDescriptor = 0
secattr.bInheritHandle = True

retval = RegCreateKeyEx(HKEY_CURRENT_USER, subkey, 0, "", 0, KEY_WRITE, secattr, hregkey, neworused)

If retval <> 0 Then ' error during open
MsgBox &quot;Aborting.&quot;
End
End If

stringbuffer = strFilePath & vbNullChar
retval = RegSetValueEx(hregkey, &quot;PDFFileName&quot;, 0, REG_SZ, ByVal stringbuffer, Len(stringbuffer)) ' write the string

retval = RegCloseKey(hregkey)

End Sub

Sorry about not including the API function declarations and constants. I can give you those, if you need them.

Hope this helps.
 
I've had very good results using the Zeon DocuCom PDF Driver. You can download a trial copy from
All the PDF settings can be set/retrieved at run time by reading an INI file/registry value depending on the Windows platform.

I've used it extensively in projects for clients to render windows from all sorts of apps as files for e-mail attachment, singly and large batches. My printer management DLL, PDXPro, includes a DocuCom object which wraps the ini/registry access and exposes the PDF settings as read/write properties. If you find the Zeon help file a bit poor, download a trial copy of PDXPro from my web site and its help file may clarify some things about various DocuCom settings.

Paul Bent
Northwind IT Systems
 
That looks good too. Thanks very much. Peter Meachem
peter@accuflight.com
 
a printer which you can use in VB for silent pdf by editing the pdf995.ini.
It costs US$ 10 - and a free app is also available.

I you need code to integrate pdf995 into your vb6 project, pls mail.
Gunthard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top