Enumerating fonts (to see if embedded) - speed issue  SOLVED

PDF-XChange Editor SDK for Developers

Moderators: TrackerSupp-Daniel, Tracker Support, Paul - Tracker Supp, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Ivan - Tracker Software, Tracker Supp-Stefan

Forum rules
DO NOT post your license/serial key, or your activation code - these forums, and all posts within, are public and we will be forced to immediately deactivate your license.

When experiencing some errors, use the IAUX_Inst::FormatHRESULT method to see their description and include it in your post along with the error code.
Post Reply
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Enumerating fonts (to see if embedded) - speed issue

Post by zarkogajic »

Hi Support,

I'm using IPXC_Document::EnumFonts to grab all the fonts in a PDF (going through all the pages). Then using IPXC_DocFontsInfo and IsEmbedded and IsSubset...

All works well - but the enumeration execution speed seems to be slow (on a larger number of documents it takes quite some time to enumerate all - even if I do nothing in OnNewFont).

Is there any other (faster) approach you could suggest to check if any of the fonts used in a document (anywhere) is not (fully) embedded?

-žarko
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Enumerating fonts (to see if embedded) - speed issue

Post by Tracker Supp-Stefan »

Hello zarkogajic,

Passed it on to the dev team and they will post here soon!

Kind regards,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Enumerating fonts (to see if embedded) - speed issue

Post by Ivan - Tracker Software »

The only other possible way to find all fonts in the document is to go through all objects (using IPXS_Document::GetObjectByNum) and if the object is a dictionary, check its Type field. For fonts, it should be "Font". Then, you can get IPXC_Document::GetFont to get IPXC_Font from this IPXS_PDFVariant, and having this font you can use its property IPXC_Font::FontInfo to retrieve font info.
But I cannot promise this way will be faster, and, secondly, it will find all fonts in a document, even unused ones.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Enumerating fonts (to see if embedded) - speed issue

Post by zarkogajic »

Hi Ivan,

Thanks, will try.

Btw, the EnumFonts implementation - is it the same as grabbing all IPXC_ContentItems on all pages and looking for PXC_CIType
== CIT_Text then getting IPXC_TState and finally CurFont ...

-žarko
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Enumerating fonts (to see if embedded) - speed issue

Post by Ivan - Tracker Software »

Not exactly. This method does not go through page content. Instead, it checks the /Resources dictionary recursively, and not only for pages as fonts may be used in many places.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
zarkogajic
User
Posts: 1370
Joined: Thu Sep 05, 2019 12:35 pm

Re: Enumerating fonts (to see if embedded) - speed issue  SOLVED

Post by zarkogajic »

Hi Ivan,

Ok, clear, thanks.

User avatar
Paul - Tracker Supp
Site Admin
Posts: 6837
Joined: Wed Mar 25, 2009 10:37 pm
Location: Chemainus, Canada
Contact:

Enumerating fonts (to see if embedded) - speed issue

Post by Paul - Tracker Supp »

:)
Best regards

Paul O'Rorke
Tracker Support North America
http://www.tracker-software.com
Post Reply