I wanted to print a report both to a printer and occasionally to a PDF-file.
With the help from the Clarion-Newsgroup I found a very easy way to do that.
First step is to insert the Global Template for PDF-output (which is part of the EnterpriseEdition and also separately available). Define a variable for the PDF-filename, one to select the printing target and one to decide to skip the print preview.
Now insert the two conditions into the right embeds and your almost done!
I placed these lines in the Init of the WindowsManager, after "Restore from INIfile"
IF GLO:PrintingDevice = EQ_PDF ! print to PDF SELF.SetReportTarget(PDFReporter.IReportGenerator) ENDThe other condition is
GLO:SkipPreview = CHOOSE(GLO:PrintingDevice = EQ_PDF, 1, 0)which I have put after "Process Field Templates".
(Of course you can put the assignment of GLO:SkipPreview in the other IF END.
I have split it in my sample)
In the Report Properties you have to replace the default value for "Runtime Skip Preview" with your variable GLO:SkipPreview.
Thats mostly all! Add salt and pepper as you like....
You can download the sample source (Clarion 6.2 EE) or the EXE as ZIP-Folder.
Here you find some more samples