Printpreview not always an accurate preview

To scale form output differently than the file-wide setting in page setup, you have to use printtopdf.

As the printpreview statement uses the page-setup setting to determine scaling, it’s not always as accurate a preview as it was in 6.

One can use printtopdf output as a substitute preview, but it involves more steps, and saves a pdf to disk in the process. It would be handy to have a simple preview-only option in printtopdf which made it functionally identical to 6’s printpreview.

David Duncan

I’m puzzled by your comments on preview accuracy. The Panorama X print preview statement and the printpdf statement are identical internally. They both use the same code to generate a PDF file. The printpreview statement puts this file in a temporary folder and immediately displays it with the Preview app. But all of the code that actually generates the PDF image is identical between these two statements.

The Panorama 6 preview was actually generated separately from regular printing, and I considered it to be less accurate, hence my puzzlement.

If you want to, you can easily generate a PDF with whatever specs you want using the printtopdf statement and then open it with the preview app. In fact, that is exactly what happens when you use the printpreview statement or choose Print Preview from the File menu. Here is the code of the printpreview statement, as you can see it actually uses the printtopdf statement.

local tempPDFname
tempPDFname = info("tempfolder")+info("databasename")+"."+timestampstr()+".pdf"
printtopdf tempPDFname,
    "orientation",info("pagesetuporientation"),
    "scale",info("pagesetupscale"),
    "height",info("pagesetuppaperheight"),
    "width",info("pagesetuppaperwidth")
openanything tempPDFname

Printpreview uses the scale setting in page setup – there is no way to change this for custom scaling a particular form without changing the scale setting in the file-wide page setup. Printtopdf has a scaling option built in.

My point is that if one wishes to use a different scaling than the global one, printpreview will not output an accurate preview of one’s scaling wishes because it does not know what they are. There is absolutely nothing wrong with the output itself, and I agree it is of higher quality than in Panorama 6.

Well, my closing point, which perhaps I didn’t make clear, is that you can easily write a short procedure that will preview with whatever settings you wish. Just adapt the code I posted above.

Thanks for the printpreview code. You are right, it’s an easy step to customise.

FYI, you could have accessed that code on your own —

  1. Choose Open View from the View menu.
  2. Press the +Libraries option
  3. Search for printpreview
  4. Double click the PRINTPREVIEW procedure.

This will open the procedure where you can examine it and copy the code if you want. There are hundreds of Panorama statements that are available this way. (Not all statements are available this way, only ones that are written in Panorama instead of Objective-C, but that’s a lot.)

I now recall you mentioned this subject during the developer course some years ago, so thanks for the reminder and for the explicit instructions – I won’t forget again. Thanks, too, for the View menu, a really useful tool.