Print to pdf from a procedure


#1

Any idea how to print a form to a pdf from a procedure in Panorama 6? The printpdf command tells me “Virtual Printer is not installed” and tells me to download something from www.codepoetry.net. That domain is for sale.

I have solved this problem using an Apple Script that I must invoke from outside Panorama, but it seems Inelegant. Any invocation of the print dialog from inside a procedure in Panorama seems to stop everything. Either the print dialog opens up after the whole rest of the procedure has been executed (not useful for trying to click on buttons in that dialog), or execution stops after the command “print dialog”

hmm. I suppose this is due to the print dialog not being in Panorama’s space. Here’s the Applescript, anyway. (“cliclick” is a cute gizmo for simulating clicks.)

tell application "Panorama 6.0.0"
activate
Execute "WINDOW {Inventory:Box Label Form}"
Execute "CALL {BoxNoToClipboard}"
set BoxNo to the clipboard
tell application "System Events"
keystroke “P” using command down
delay 0.5
do shell script "/Applications/cliclick/cliclick c:760,640 w:500 m:760,666 w:500 c:760,666"
keystroke BoxNo
delay 0.2
keystroke return
end tell
end tell


#2

Open the Custom Statements wizard. Under Libraries, you should see one named _PDFPrinting. Click on it, and you will see a statement named PDFSETUP. Click on that to see its documentation.

Following the setup you would just use

Print ""

or

PrintOneRecord ""

with “” instead of dialog as the parameter.


#3

And thank David for the fact that it exists


#4

The easiest thing to do is open the form and print it but when you get the print dialog, just"save as .pdf". After you do this one time, using print “” in a procedure will continually print the form to pdf in the same place you saved it the first time.

Jeff Kozuch
President, Acacia Systems
Panorama Programming and Training
Apple Certified Technical Coordinator
Member, Apple Consultants Network
jk@acaciasystems.com
http://www.acaciasystems.com
562-437-7690


#5

OK, first issue, under Wizards->Developer Tools->Custom Statements “Libraries” I do not see _PDFPrinting. The list goes from _PanoramaLib to _PrinterLib. Under _PrinterLib I see PRINTPDF but that takes me to the same command that requires a library from a place that doesn’t exist.

Hmm. I am using Panorama 6.0.0 Build 94356 on OS 10.6.8 if that is a clue. What is your environment?


#6

That is a cool idea but it begs the question of naming the document. Oh wait, rename:

print ""
filerename folder(“Rosmarinus:Users:ray:Desktop”), “TEMP.pdf”, STR(«boxNo») + “.pdf”

thanks! :smiley:


#7

That’s pretty old. The recent version is build 121629 (Nov 16, 2013).


#8

Obviously the original question was for Panorama 6, but just want to note for others that may be reading this that Panorama X has the PrintToPDF statement which gives the programmer full control over the generated PDF file, including orientation, paper size, scaling, page order and page subsets.


#9

My _PDFPrinting library wasn’t included with the installation until the next version. Prior to that, you could download a copy of it from https://dl.dropboxusercontent.com/u/1238484/PDFPrinting.zip. You can still get it there. Once you unzip, you should put it in the Libraries folder, in the Extensions folder, in your Panorama folder. Quit Panorama if it is running. When you relaunch, it will be ready for use.


#10

Using the same version of Panorama you said you are using, I can’t duplicate this. After Print dialog I used the dialog to save as PDF, and then the procedure resumed when the dialog closed.