PDF scripting

I was tasked with automating the collection of some reports from our remote locations. The machines are sometimes used by local staff at the location and their use is accidental. The reporting software is somewhat limited and only allows you to print to the default printer. The department that receives these reports does not want to change anything and they like to receive their PDFs.

I can programmatically change the default printer to use the PDFCreator printer (and switch it back so the staff at that location won't notice) and I can programmatically generate a report and send it to the printer.

My problem is that it brings up a window from PDFCreator asking for a filename and some metadata for the PDF.

I would like to minimize pop-ups and hopefully make my report collection as unobtrusive as possible for local users.

Is there an easy way to automate the PDFCreator interaction, or did I leave it with SendMessage (or similar) and simulate the user experience?

PDFCreator is not required, I would also suggest suggestions for other PDF-print-type softwares that solve this problem as well.

+2


source to share


3 answers


PDFCreator is a VB wrapper around ghostscript, so you should be able to modify the PDFCreator so that you don't open the dialog and give it a filename in any other way.



Alternatively, you can use the postscript printer driver with output directed to FILE: and then you can programmatically call ghostscript to convert PS to PDF yourself. I don't see a way to stop the embedded postscript driver windows from creating a dialog when the port is set to FILE: and when the port is set to PSFile, I can't figure out where the file is going. However, GSPSprinter.html contains instructions for setting up a Ghostscript postscript printer for a fixed file location so you don't get any dialogs.

+1


source


AFAIK, you are left to play SendMessage games. It's not too bad, grab a copy of Spy ++ and have fun!



+1


source


The PDFCreator command line says you can pass / NoStart to close the print window you can provide the .INI file like this:

"C: \ Program Files \ PDFCreator \ PDFCreator.exe" / NoStart / OptionsFile "C: \ dev \ convert \ convert.ini" / PF "DOC_TO_CONVERT.doc"

which contains the "auto" options:

[Options] UseAutosave = 1 UseAutosaveDirectory = 1 AutosaveFormat = PDF AutosaveDirectory = NoConfirmMessageSwitchingDefaultprinter = 1

0


source







All Articles