PDFDocument - glyphs and insert other PDFs

Hi all - just wanted to double check what I think are known limitations with PDFDocument today…

Firstly - text is only ANSI character set… so I can’t use glyphs / symbols from fonts like SF Pro at the moment?

Secondly - I can’t see a way of drawing a PDF file into a PDFDocument without having it rastered first?
In my PDF project I am wanting to create a file with some icons which are already created as PDFs. The only way I’ve done this so far is to output a PNG version of the icon but this looks terrible when scaled down to the correct size. Inserting the source PDF icon file at the right scale should give me the result I am hoping for…

That’s unless someone has a better way scalling down the PNG file so they are sharp in the output PDF.

Thanks all

dave

Sadly this is a known issue and Xojo’s PDF Framework engineer @Javier_Menendez said, he currently hasn’t another “solution” for handling Picture in PDFDocument without increasing the size of The PDF file. I could live with that. Maybe he has some more new information about this topic for us users?

You could try MBS Xojo DynaPDF Plugin instead.

David, I think you had a license, so we may offer an upgrade price, if you are interested.

I might well do that thank you Christian - just exploring options.

1 Like

I think I found an acceptable solution (on macOS anyway)… it’s not the ‘insert a PDF file in a PDF document’ approach I was hoping to use, but the results look promising.

v2021 r2 has a PDFGraphics.Scale method - So I a calling this with a 0.4, 0.4 value and then drawing the PNG version image.ImageAt(2)
After I’ve called DrawPicture I am switching .Scale back to 1.0

So far so good.

Would like to have had the option to use SF Pro symbols but if this works then I am happy for now.

Hi @David_Renwick

so I can’t use glyphs / symbols from fonts like SF Pro at the moment?

Image stuff has been improved for a future release of Xojo, so you can create picture (PNG) based pictures from these glyphs / symbols… preserving the transparency, for example.

I can’t see a way of drawing a PDF file into a PDFDocument without having it rastered first?

That’s because PDF Document is not a PDF analyzer/parser… that is, it is not possible for PDFDocument to recreate objects from the PDF streams available on a file; both if it is just a “drawing” or a more complex document.

In my PDF project I am wanting to create a file with some icons which are already created as PDFs. The only way I’ve done this so far is to output a PNG version of the icon but this looks terrible when scaled down to the correct size. Inserting the source PDF icon file at the right scale should give me the result I am hoping for…

Same answer than the previous point. This has been improved so PNG based pictures are just ok… and if you provide them at the “right” size you want to use them in the PDF document, even better!

Sorry, because it is in Spanish… but the Description field of the video includes a link to download the Xojo project. Maybe it can help you to get a PNG file from any SF Font glyph (always you run it from macOS 11+): https://www.youtube.com/watch?v=lK-MdN2JLzc

Thank you @Javier_Menendez

I am pushing ahead with the technique of using the Scale method for now.

Keep up the great work on PDFDocument :+1:t2:

That technique is just great!

Thank you for your nice words about our work David! :heart:

1 Like