Page 1 of 1

PDF printing without printing

Posted: Tue Mar 27, 2018 11:15 pm
by Zood
Hello all,

I am using the Open printing to pdf tPDFPath function, yet not without some issues
My goal: Save a piece of a card as a pdf-file without printing a physical sheet, so nothing gets sent to my printer.

A piece of my code:

Code: Select all

on mouseUp
   Ask file "Where do you want to store the file?"
   if "." is not in it then
      put it & ".pdf" into tPDFPath
   else put it into tPdfPath
   
   if the result is "Cancel" then
      go to previous card
      exit mouseUp
   end if
   
   set the visible of field "Number" of card "PrintCard" to true
   set the printmargins to 0,0,0,0
   set the printpaperorientation to portrait 
   open printing to pdf tPdfPath
   
   put the number of lines in field "PrintField" into tLines
   put field "PrintField" into tTotal
   put tLines / 32 into tTotalPrintNumbers2
   add 0.5 to tTotalPrintNumbers2
   put round(tTotalPrintNumbers2) into tTotalPrintNumbers
   put empty into tCounter
   if tLines > 32 then
      repeat until tTotaal < 32
         add 1 to tCounter
         put line 1 to 32 of tTotaal & CR & "Blz " & tCounter & " v/d " & tTotalPrintNumbers into field "PrintField"
         print card "PrintCard" from 317,-90 to 912,752
         delete line 1 to 32 of tTotaal
      end repeat
   else
      print card "PrintCard" from 317,-90 to 912,752
   end if
   close printing
   launch document tPdfPath
   go to previous card
end mouseUp
The PDF is created just fine, is launched just fine and everything is fine: I am happy!
just 1 thing: My printer also prints a copy of the pdf I have just created, that is the fault.
As I am using the "Print to pdf tPDFpath", should it not send anything to my printer?

Also funny: It only prints something when I try it on my windows standalone, on my Macbook nothing gets printed

Any help is useful!

Thanks in advance

Re: PDF printing without printing

Posted: Wed Mar 28, 2018 8:08 am
by thatkeith
That does seem strange. From the Dictionary:
The open printing to pdf command starts a print loop that outputs
directly to a PDF file rather that the currently configured printer.
Have you tried simplifying your code as much as possible purely for testing purposes? A simple "hello PDF world" kind of thing?

Re: PDF printing without printing

Posted: Wed Mar 28, 2018 8:17 am
by livecodeali
What version are you using? There was a bug in 9 recently with the loading of revPdfPrinter which is possibly what you are seeing: https://quality.livecode.com/show_bug.cgi?id=20814

Re: PDF printing without printing

Posted: Wed Mar 28, 2018 3:39 pm
by dunbarx
Do test with v.8.

I have had no issues at all with "open printing to pdf".

Craig Newman

Re: PDF printing without printing

Posted: Wed Mar 28, 2018 8:23 pm
by Zood
Currently using 9.0.0 DP11 but will try with V8, I will let you know!

Re: PDF printing without printing

Posted: Wed Mar 28, 2018 8:38 pm
by livecodeali
It’s fixed in 9 RC 1 also, if you want to stick with 9.