Out of Microsoft Visual Foxpro (VFP), I can print a report to the printer “PDFCreator”. I determine the PDF Creator output directory for the pdf output file in the PDF creator options. This works perfect!
My need is to determine the pdf file name before every printing process. This time, the file names are like by the set tokens. But I would need a name not dependent from the tokens.
In VFP, a print command looks like:
REPORT FORM c:\myform TO PRINTER
whereby the PRINTER is set to the printer PDFCreator.
Another possibility is to start a “DOS command” like
RUN pdfcreator.exe runtime-parameters
Do you see a possiblity to set a different output pdf file name for every printing?
I can see two potential solutions but I don’t know how suitable either of them is for your workflow: If VFP allows this, you could interact with PDFCreator through the COM interface to set the file name for each print job: http://docs.pdfforge.org/pdfcreator/latest/en/pdfcreator/com-interface/
My 1st problem (solved) was I didn't know how to program the ActiveXObject but I found it in the examples of Sazan Hoti (f.e. ChangeOutputFormat.js). The VFP equvalent is
PDFCreatorQueue = CREATEOBJECT("PDFCreator.JobQueue")
My second problem (unsolved) :
To print a report with VFP is easy. F.e.
SET PRINTER TO NAME PDFCreator
myprintfile = "c:\xyz\myfile"
REPORT FORM myform TO &myprintfile. This command generates ok, but myprintfile is in ps format and not in pdf I need.
A command like (js: PDFCreatorQueue.WaitForJob(10); ) and following commands for conversion into pdf after the VFP REPORT command never can reach the "print job" and I get answers like "Print job did not reach the queue within 10 secondes".
What's wrong in my thinking?
it is as I wrote:
The printer “PDFCreator” is not a Hardware printer but by your program PDFCreator generated “virtual printer”
It is also possible to print to a Hardware printer. In this case I have to write f.e.
SET PRINTER TO NAME HP2800
REPORT FORM myform TO Printer
This is generating a correct printout directly on the printer.
The ps file from PDFCreator is also correct (I can show it by Linux system)
myprintfile = “c:\xyz\myfile”
REPORT FORM myform TO &myprintfile
My problem is how to convert it by your program to a pdf file.
Was it your question?
Should I append the ps file?
usually printing to the PDFCreator printer will automatically crate a .ps and .inf file in %temp%\PDFCreator\spool , but never as output format, so I am having problems to understand where this .ps file is coming from in the first place. The printjob should only temporarily get stored as .ps file and deleted after PDFCreator converted it to PDF or one of the other output formats.
If SET PRINTER TO NAME HP2800 REPORT FORM myform TO Printer sends the file to the printer , shouldn’t sending the file to PDFCreator read
SET PRINTER TO NAME PDFCreator REPORT FORM myform TO Printer
instead of myprintfile = "c:\xyz\myfile" REPORT FORM myform TO &myprintfile
For me this looks like you are setting up FP to print to file and not using PDFCreator at all.
You are absolutely right! Thank you, Robin.
I could see it in the ps file it was generated by the Windows default printer and not by PDFCreator.
I would like to upload my (a little bit extended) VFP example. How could I do that?
Georg