Skip to main content
Known Participant
Jul 14, 2021 11:17 AM UTC
Answered

Unable to read paged within AVDocDidOpen notification handler

I have a plugin that's reading the fonts within a pdf document

I have written code to use PDDocEnumLoadedFonts to read all the fonts loaded by the doc

This code will be run after the AVDocDidOpen fired by the runtime

 

I am expecting to be able to read fonts

But no fonts are read 

It seems that the whole of doc is not loaded when AVDocDidOpen is fired

If I run the same code say on a pointer move, the fonts are found

 

Regards

Rahul

This topic is closed to new replies. Start a new post to keep the conversation going.
Test Screen NameCorrect answer
Legend
Jul 14, 2021 12:23 PM UTC

"I am expecting to be able to read fonts" You should not expect this. You should expect no fonts to be loaded, this should be clear from the documentation "PDDocEnumLoadedFonts... Enumerates all the fonts that have been encountered so far. A font is loaded when a page that uses it is processed. This typically happens when a page is drawn or its thumbnail image is created."

 

It is a fundamental part of Acrobat that pages are not even read from disk until they are needed. This is very important. A file might be 20GB in size and have 500,000 pages. The user would not want to wait 20 minutes when opening, while all the fonts were scanned for your convenience. By coincidence, I recently posted a reply giving two methods of enumerating a PDF to get a full list of fonts - check the forum. These are a lot more work than just calling one method!

3 replies

Test Screen NameCorrect answer
Legend
Jul 14, 2021 12:23 PM UTC

"I am expecting to be able to read fonts" You should not expect this. You should expect no fonts to be loaded, this should be clear from the documentation "PDDocEnumLoadedFonts... Enumerates all the fonts that have been encountered so far. A font is loaded when a page that uses it is processed. This typically happens when a page is drawn or its thumbnail image is created."

 

It is a fundamental part of Acrobat that pages are not even read from disk until they are needed. This is very important. A file might be 20GB in size and have 500,000 pages. The user would not want to wait 20 minutes when opening, while all the fonts were scanned for your convenience. By coincidence, I recently posted a reply giving two methods of enumerating a PDF to get a full list of fonts - check the forum. These are a lot more work than just calling one method!

Translate
RdMaxAuthor
Known Participant
Jul 15, 2021 12:31 PM UTC

Hey, many thanks!

 

I tried searching your posts on forum and its a long list!

Do you happen to remember the title of the posts?

Translate
Legend
Jul 15, 2021 12:47 PM UTC

1. Enumerate pages, enumerate all text runs, check PDEFont for embedding flags.

2. Enumerate all font dictionaries in all Resources dictionaries (recursively into Form XObjects etc.), checking the FontFileXXX values in font attribute dictionaries.

 

It was this post: https://community.adobe.com/t5/acrobat-sdk/is-it-possible-to-determine-missing-fonts-psname-and-the-font-format-in-a-pdf-file/td-p/12169036

Translate