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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting location and filename for PDF file 2

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hi,

For a while now I've been trying to find out how I can get the file path and file name set when printing directly to the acrobat distiller virtual printer from a powerbuilder application.
I do not want to use the option to select the filename and path, but whould like to set them in advance from the printing application. Setting the port and options for the acrobat distiller virtual printer is not a desired solution, and I can't find any calls to set them from the application itself.
When setting a path and filename in the win.ini file results in an severe-error on the second print action, so that's not an option. (Or is it?)

Any ideas?

Coretta van Nijnatten
Powerbuilder programmer
 
Hi,

I have been reviewing this thread and have made no progress. I have a VB app that creates Word Documents. I need to print these documents (hundreds of them each month) as PDF files (I don't care if I use Writer or Distiller). I can not have Acrobat prompting me for file names. I need to set file names in code. HOW?

Windows 2000
Office 2000 (Word 9.0, Excel 9.0, Access 9.0)
Adobe Acrobat 4.0

The sample code above keeps printing to the default directory.


 
How to write a .prn from Powerbuilder for Distiller to poll:

// PRINT TO FILE (useful for Adobe Distiller)
// Note1: Set Adobe Distiller to watch for .prn files in the below .filename folder.
// Note2: Set your PC's default printer to be a post-script driver-type printer.
dw_1.object.datawindow.print.filename = 'c:\watch\in\my.prn'
dw_1.print()
 
The way I took care of this problem was to pull the code from the Acrobat modules added into Excel. There is an Acrobat toolbar in Excel. Right click and select customize. There is a button that toggles printer from "Prompt" to "Auto" and a button that runs a Macro called "printPDFfile". The macro uses the toggle setting. Your're interested in the "Auto" side of the code. Basically just canibalize the code. Start with the printPDFfile function. Bring it into your app and try to compile it. Something will be unrecognized. Go find it in the Excel VB environment and bring it over. Keep doing this until it compiles.

This works for 3.0 and 4.0.
 
Regarding Pdfwriter:

This setup causes PDFWriter to generate the designated .pdf
file each time you print to the PDFWriter "Printer".
You will need to rename the newly generated .pdf file to
allow the next .pdf file generation otherwise the first
file will be overwritten. These entries in the registry
turn off the prompting screen. Also, lately I have not been able to find the original document from Adobe.
Maybe they don't want us to know about it any more.

Known to work with 4.0 cannot speak for 5.x. Good luck!


6. Open to the HKEY_CURRENT_USER\Software\Adobe\Acrobat PDFWriter key (i.e., folder).

7. Right-click the Acrobat PDFWriter Key and choose New > String Value from the pop-up menu.

8. Type "PDFFileName" for the new value.

9. Right-click the newly created string value PDFFileName and choose Modify from the pop-up menu.

10. Type the name of the PDF file you want automatically generated in the Value Data field, followed by an asterisk, and then press Enter. For example, type "Mypdf.pdf*." If you want to save the PDF files to a specified location, type the path to that location, followed by an asterisk. For example, type "C:\MyPDFFiles\Mypdf.pdf*."
Note: If an asterisk is not added to the end of the file name, Acrobat PDFWriter will delete the string value after using it.

11. Right-click the Acrobat PDFWriter Key and choose New > String Value from the pop-up menu.

12. Type "bDocInfo" for the new value.

13. Right-click the newly created string value PDFFileName and choose Modify from the pop-up menu.

14. Type "0" (zero) in the Value Data field, and then press Enter.

15. Exit from the Registry Editor. (Your changes will be saved automatically.)


 
joelap,

Last year I was determined to get this to work, and I ended up on a workaround (I now simply use MS's Snapshot - also free and there is no editor that I'm aware of). After the file is printed to the default directory, I use code to move then rename file so there is no prompting and it's all automatic, but it also requires hard coding the information...

I would use these 2 keywords (look up in help for proper syntax):

Move
Rename

this took care of that issue for me... Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top