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
pageHeight=79*9
If PageSetup <> "" then //PageSetup contains properties
ps.setupString=PageSetup
// open Print dialog with Page Setup properties
g=OpenPrinter(ps)
else
g=openPrinterDialog(ps) //open Printer Dialog and set PageSetup
PageSetup = ps.SetupString
End if
If g <> Nil then //user didnt cancel Print dialog
stp=WordProcessor_container1.TextArea1.StyledTextPrinter(g,pageWidth-48)
Do Until stp.EOF
stp.drawBlock 36,36,pageHeight-48
if not stp.eof then //is there text remaining to print?
g.NextPage
end if
Loop
End if
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.