Hi,
I have given a boolean field "Auto Convert to PDF" on the request form of a report. If it is checked, then while running the report, it should automatically create a PDF file without prompting for printer or file name (file name should come from a variable). I want to use Adobe PDF printer to print the report.
Any idea about the coding will be very helpful for me. I have tried to write some code in OnPostReport, but it is creating an infinite loop with every time prompting for file name.
0
Comments
I experienced using Adobe Destiller as some kind of issue!
The major problem is, that using Adobe Destiller, your not able to specify the filename!
So you have to wait for the driver to finish creating the pdf-file:
- that is, you have to know, what file to wait for
- and how long you willing to wait, before stopping the process (e.g. if the driver is stopped by the user)
Once the file is finished you are able to rename the file.
There's other pdf-drivers, which lets you set the file name: So I'd advise you to search the forum.
Thoms Hviid Thorn
But I do not have other options as PDF writer. It must be Adobe. Also I can not use any other objects to manage this situation. The boolean field will decide whether to show preview or print normally or to convert the output automatically to PDF without user interaction. How can I run the report within the report if I want to use "Printer Selection" table.
What I mean to say is that, If I do not check the boolean field, the report should be printed as usual ignoring "Printer Selection" entry. But if I check the field, the report should be automatically converted to PDF using the printer mentioned in the "Printer Selection" table without asking for file name. It should take the file path/name from a variable defined in the report. Is there any way out to achieve this condotion?
Can anybody give some code samples?
where ChangeFileName waits for the driver to finish and then renames the file.
Thoms Hviid Thorn
I will try this out.
But the main problem is that I need to run the same report using REPORT.RUNMODAL from within the same report on the basis of the condition "Convert to PDF". It is actually creating an infinite loop by runnning the same report again and again without recognizing the code
IF "Convert to PDF" THEN BEGIN
REPORT.RUNMODAL(Same Report,,Rec);
CurrReport.QUIT;
END;
Is it possible to run the same report within the report and some condition can restrict it to execute the code in the next loop? Actually we can not afford to use a different report. Actually the report is the Statement report (116) that I want to convert to PDF. There are other options in the request window which decide the output of the report. If I use another report, then how can I pass those parameters?
Best Regards,
Amitava.
Yes, you can handle this - but I'm not sure which way works best for you:
- through a function call:
- On the report you create a function "CreatingPDFFile",
which sets a global variable of type boolean true.
- If the global variable is true, you dont check the PDF-field
- This requires, that the report is declared as a variable etc.
- or you modify the record, and set the mark back after printer.
Allthough this may create problems if the reports stops execution
due to an error/cancellation, since the mark is no longer set.
Thoms Hviid Thorn