Skip to main content
Known Participant
July 14, 2021
Answered

Unable to read paged within AVDocDidOpen notification handler

  • July 14, 2021
  • 1 reply
  • 687 views

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 has been closed for replies.
Correct answer Test Screen Name

"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!

1 reply

Test Screen NameCorrect answer
Legend
July 14, 2021

"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!

RdMaxAuthor
Known Participant
July 15, 2021

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?

Legend
July 15, 2021

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