H folks.
I spent a full year and quite a bit of cash getting hold of a custom font and rewriting my app so that I could use scalable custom glyphs in a PDF
It works very well.
BUT having shipped, I’m now hearing from people that if they modify the PDF in any way (highlight text, insert a page…) using PREVIEW on the Mac, all my custom glyphs completely disappear.
This makes the change look like a major bug rather than a major feature.
Yet I don’t know what I can do to prevent this happening… once the PDF exists its almost ‘out of my hands’
(It’s more likely a Preview bug than anything else: Wondershare PDF Editor doesn’t break it, nor does Adobe Acrobat)
Does anyone know what could cause this behaviour and how I can avoid it?
Can’t reproduce on High Sierra with selecting text.
I’d recommend working with Christian directly to solve this issue. From what I read on the TidBits website Preview seems to have quite a few bugs with pdfs.
Select text, highlight in yellow, save, then reopen?
The file size drops, the symbols vanish
It seems like the embedded font is being lost in the process.
This happens even if the font is locally installed (just tested that in case that was the issue)
Because that worked to display the glyphs, but setfont didn’t, during development.
Sometimes they displayed different glyphs for the same character.
[quote]
And you really want to add glyphs directly?
Why not use kcpUnicode and draw text?[/quote]
Some of the symbols actually are put in using that method.
All vanish when Preview saves the file, but not when Adobe saves.
OSX 10.4 used to have a ‘save as PDFX’ option, Sierra does not.
As far as I can tell it is the loss of the embedded font which is the issue.
While I can with some justification say that the ‘bug’ lies in Preview, that won’t be believed by many customers.
i try insert blank page or insert another pdf and the glyph still show correctly on High Sierra but after saving, all the glyph disappear… just the grid is left. i was using Preview.
I don’t think its a DynaPDFMBS bug, but if there is ‘something I can set on the PDF’ that avoids this issue I would be grateful to hear it.
So is this a small project to you, Christian, or are you suggesting I might get some response from Apple?
[code] dim pdf as dynapdf
pdf=new DynaPDF
call pdf.setpagemode( 2)
call pdf.CreateNewPDF specialfolder.desktop.child(“Sample.pdf”)
call pdf.AddFontSearchPath (specialfolderresources, false) //allow DynaPDF to see the font if not installed
//specialfolderresources is a method that returns the resources folder for windows or Mac, release or debug
call pdf.append
call pdf.SetFontAnsi “Ursasoftware”, pdf.kfsNormal, 12, true, pdf.kcpGlyphIndexes
call pdf.WriteText 10,pdf.GetPageHeight - 40,“hello there this is a test”
call pdf.endpage
call pdf.CloseFile
[/code]
If you use kcpGlyphIndexes, please also use the Write methods for Glyphs, e.g. using
WriteText(PosX as Double, PosY as Double, glyphs() as Integer) as Boolean
If you use kcpUnicode and your font has the characters and a correct unicode mapping table, the mapping would work.
But as far as I see, it either maps normal letters to symbols or it has no correct table.
Well, again, I think the font does not have the correct unicode map.
You can use the string variant of the functions and pass text of course, but I don’t expect that will work well.
(I spent a long time on that)
But it’s not the cause of the font going missing.
That happens if I embed even a single character, and unicode functions.
Sam Rowlands recently revealed that the older PDFKit version has been replaced by the code from iOS and Apple have apparently damaged the PDF engine in OSX
Looks like this is one of the casualties.
Adobe works, and I found a couple of readers on iOS that also work properly.
So I need to have my pre-emptive ‘apologies for Apple’ ready. Sigh
I know. Thanks.
But the issue arises ‘after the PDF is out of my hands’ … the PDF files will be emailed to other people, and used on desktop and tablets.
I can say that the bug is in Preview. There are many similar reports of it losing OCR data from other apps too.
Nothing I can do is going to make Preview work, so it becomes a documentation thing
This thread is old, but looking at something unrelated today I found out about the changes to PDFkit in mac OS since 10.12 @Jeff Tullin is referring to and I thought it could help complement the information in the thread for future users.
If this is true it’s a shame. PDF handling was one of the stars of Mac OS and while cross-compatibility is great, replacing a capable library with a mediocre one is always a bad step back.