I have a letters in Styled Text that I am printing (one for each record) with data being merged in from the database.
All letters print to the printer perfectly, but sometimes you want to open the letters in Print Preview first.
I call an initial OpenPrintDialog, save the print settings, and continue printing using the code below:
Dim stp as StyledTextPrinter
Dim g as Graphics
Dim ps as New PrinterSetup
Dim pageWidth, pageHeight as Integer
pageWidth=72*7.5 //default width and height
If PageSetup <> "" then //PageSetup contains properties
// open Print dialog with Page Setup properties
g=openPrinterDialog(ps) //open Printer Dialog and set PageSetup
PageSetup = ps.SetupString
If g <> Nil then //user didnt cancel Print dialog
Do Until stp.EOF
if not stp.eof then //is there text remaining to print?
The problem is that when I select “Open PDF in Preview” only the first page opens in Preview - the rest go straight to the printer. Is there a way to have all the letters in the print job open in Preview?
When you print to the printer, it doesn’t matter if all the documents print as individual docs, but when printing to a PDF, it would be better to combine all the documents into a single PDF document. Is there a preference for this option?
I tried to add all the letters to a single TextArea but I think I hit the maximum number of characters for the field.
You may try removing
g.nextPage when printing to PDF.
[quote=289393:@Michel Bujardet]You may try removing g.nextPage when printing to PDF.
Thanks for the idea. Just tried it - no effect.
I see now that g.NextPage is specifically for output to a printer. So, it appears that the option to “Open PDF in Preview” is not stored in the print settings and cannot be recalled for the remaining pages of output.
The other way would be to create a series of pictures with the same routines you use to print, and simply launch them all in Preview.
That would work for a preview.
[quote=289419:@Michel Bujardet]The other way would be to create a series of pictures with the same routines you use to print, and simply launch them all in Preview.
That would work for a preview.[/quote]
Much appreciated, Michel. I really don’t need a Preview. I was just thinking that if the Print Dialog shows “Open PDF in Preview” then it should work.
I did try to combine the StyledText into a single TextArea to print as a single document, however, the formatting changed when the StyledText was moved (centered text became Left Justified). I also wasn’t sure how to create a Page Break in a TextArea.
Note : there is a long standing "bug’ related to Styled Text and Alignment, do a search of this forum and you should run across some previous discussions on how it doesn’t work.
However I am confused as to why NEXTPAGE doesn’t work for you with PDF… it seems I have apps (I will find and retest), the create documents ONE way, and its up to the end user as to what the destination is (PDF or Print)… but the document creation part of the program doesn’t “care”
On OS X: it have that in a PopupMenu (bottom left).