PDF Printing

Mark Waddingham mark at livecode.com
Tue Oct 4 14:43:29 EDT 2022


On 2022-10-04 16:20, Dan Friedman via use-livecode wrote:
> Here are examples of the printouts (the PDFs):
> Print to PDF - https://www.clearvisiontech.com/WORKING/PrintToPDF1.pdf
> Print to Printer - 
> https://www.clearvisiontech.com/WORKING/PrintToPDF2.pdf
> 
> Any thoughts or ideas?

Someone had a similar problem in the past (Paul or Klaus maybe?) - it 
turned out that it was because no explicit font was set on the stack (or 
controls) - meaning that it was using the macOS 'theme' font.

This isn't actually a 'discoverable' font in the various font related 
APIs - and appears to be (somewhat!) hard-coded in the various low-level 
Apple graphics rendering APIs.

The PDF printer does use the correct fonts and metrics - and CoreText 
(on macOS) to do font layout - but the actual PDF generation is done 
using a cross-platform library (so the output is the same on all 
platforms) which relies on getting the 'real' font data for the given 
font (which it does not in this case) and not macOS (CoreGraphics-based) 
printing. The latter appears to be able to deal with the 'magic' fonts 
(unsurprising as its all Apple stuff), but our pdf printer cannot.

If you set the stack to an explicit font then the problem should go 
away.

Alternatively, if this is a mac-only product, you can use macOS's PDF 
printing capability by setting the printerOutput property to 
"file:<filename>" - on macOS the latter will generate a PDF (i.e. its 
the same as choosing 'Save As PDF' from the printer dialog).

Hope this helps!

Mark.

-- 
Mark Waddingham ~ mark at livecode.com ~ http://www.livecode.com/
LiveCode: Everyone can create apps



More information about the use-livecode mailing list