IPXS_Document Get First Indirect Object + where (at what byte) is that object  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: 1372
Joined: Thu Sep 05, 2019 12:35 pm

IPXS_Document Get First Indirect Object + where (at what byte) is that object

Post by zarkogajic »

Hi Support,

Having

IPXS_PDFVariant obj = IPXS_Document.GetNextIndirect(0)

It seems this does not get the first indirect object in the body of the file (after header) ?

Is there a way to know if the object retrieved above is within the first 1024 bytes of the PDF?

What is the sort order of objects retrieved using GetNextIndirect ?

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

Re: IPXS_Document Get First Indirect Object + where (at what byte) is that object

Post by Ivan - Tracker Software »

GetNextIndirect takes a pointer to ULONG_T value, not value itself.
So, the correct use of this method would be:

Code: Select all

ULONG_T enumPos = 0;
IPXS_PDFVariant obj = IPXS_Document.GetNextIndirect(&enumPos);
In regards position (offset) of the object in the document stream - unfortunately, as I see such a method is not available via the SDK. Will add them in the next release.
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: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: IPXS_Document Get First Indirect Object + where (at what byte) is that object

Post by zarkogajic »

Hi Ivan,

Thanks. Can you also comment on the sort order of objects retrieved via GetNextIndirect ?

What I'm after is optimizing this code of mine:

https://forum.pdf-xchange.com/viewtopic.php?f=66&t=33063&p=139175&hilit=islinearized#p139175

The "problem" is that if the document is not linearized the above algorithm will iterate over all indirect object - and if there are many - no reason to do so - as the linearization object (if there is one) must be within first 1024 bytes of the file.

I've refactored that code to first get the 1024 bytes (from CoreDocument.SrcInfo.File.Stream) and find the first "obj" and then check if it is the "linearized" one..
However, this cannot be used for documents opened from IStream (https://forum.pdf-xchange.com/viewtopic.php?f=66&t=37890)


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

Re: IPXS_Document Get First Indirect Object + where (at what byte) is that object

Post by Ivan - Tracker Software »

GetNextIndirect goes through all xref tables and all through all records in them.

What we can do, is to add a method to the IPXS_Document which will return Linearization dictionary or null if absent.
We already have it, but it is not exposed in the SDK.
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: 1372
Joined: Thu Sep 05, 2019 12:35 pm

Re: IPXS_Document Get First Indirect Object + where (at what byte) is that object  SOLVED

Post by zarkogajic »

Hi Ivan,

That would be great - thanks.

User avatar
TrackerSupp-Daniel
Site Admin
Posts: 8610
Joined: Wed Jan 03, 2018 6:52 pm

IPXS_Document Get First Indirect Object + where (at what byte) is that object

Post by TrackerSupp-Daniel »

:)
Dan McIntyre - Support Technician
Tracker Software Products (Canada) LTD

+++++++++++++++++++++++++++++++++++
Our Web site domain and email address has changed as of 26/10/2023.
https://www.pdf-xchange.com
Support@pdf-xchange.com
Post Reply