Unable to read \Annots to get file attachment from page

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

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

Post Reply
truane
User
Posts: 7
Joined: Tue Dec 07, 2010 3:46 pm

Unable to read \Annots to get file attachment from page

Post by truane »

I'm using C#

Ok so i have used the low level API to navigate all the way down to /Annots on the page without any issue and get

Dictionary (7061184) \Pages\Kids[3]\Kids[7] :- Type(PVT_NAME = 'Page' ), Annots(PVT_OBJREF = 'Is Dictionary' ), Parent(PVT_OBJREF = 'Is Dictionary' ), Rotate(PVT_INT = '0' ), CropBox(PVT_ARRAY), Contents(PVT_OBJREF = 'Is Dictionary' ), MediaBox(PVT_ARRAY), Resources(PVT_OBJREF = 'Is Dictionary' )

then using the Annots as the variant

XcPro40Defs.DPDFVariant_Type nefvType;
result =XcPro40Defs.PXCp_VariantGetType(variant, out nefvType);

if (nefvType.Equals(XcPro40Defs.DPDFVariant_Type.PVT_OBJREF)){
int pxcObject;
int subDictionary;
result = XcPro40Defs.PXCp_VariantGetObject(variant, out pxcObject);
result = XcPro40Defs.PXCp_ObjectGetDictionary(pxcObject, out subDictionary); <--- This returns 0 for sub directory?
}

the PXCp_VariantGetObject returns a result of 0 and the pxcObject = 511035452
but PXCp_ObjectGetDictionary returns a result of 0 which is success but the subDictionary= 0

I am using xcpro40.dll version 4.0.316.1 from release Version 5.5.315.0 of PDF-XChange PRO SDK

This only happens to the /Annots Dictionary on the page every other Dictionary works fine can tacker not deal with /annots.

The ultimate goal is to get to the /FS underneath it to extract the file stream.

Please Can You help!
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Unable to read \Annots to get file attachment from page

Post by Lzcat - Tracker Supp »

Hi.
You should take a closer look at PDF specification when using low-level API - Annots is array, not dictionary.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
truane
User
Posts: 7
Joined: Tue Dec 07, 2010 3:46 pm

Re: Unable to read \Annots to get file attachment from page

Post by truane »

i would agree but tracker says it is object

result =XcPro40Defs.PXCp_VariantGetType(variant, out nefvType);

nefvType = PVT_OBJREF not PVT_ARRAY

so have to do XcPro40Defs.PXCp_VariantGetObject(variant, out pxcObject);

and there is no PXCp_ObjectGetArray(pxcObject, out array);
only PXCp_ObjectGetDictionary or PXCp_ObjectGetStream

I even tried result = XcPro40Defs.PXCp_VariantGetArray(variant, out pxcArray); but this throws and error
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Unable to read \Annots to get file attachment from page

Post by Lzcat - Tracker Supp »

truane wrote:i would agree but tracker says it is object

result =XcPro40Defs.PXCp_VariantGetType(variant, out nefvType);

nefvType = PVT_OBJREF not PVT_ARRAY
Sure, because in your case Annots array is indirect variant.
truane wrote:so have to do XcPro40Defs.PXCp_VariantGetObject(variant, out pxcObject);

and there is no PXCp_ObjectGetArray(pxcObject, out array);
only PXCp_ObjectGetDictionary or PXCp_ObjectGetStream

I even tried result = XcPro40Defs.PXCp_VariantGetArray(variant, out pxcArray); but this throws and error
But you missed function PXCp_ObjectGetBody, so correct sequence for indirect array is PXCp_VariantGetObject > PXCp_ObjectGetBody > PXCp_VariantGetArray.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
truane
User
Posts: 7
Joined: Tue Dec 07, 2010 3:46 pm

Re: Unable to read \Annots to get file attachment from page

Post by truane »

Yes after my last message I went back to documentation and noticed PXCp_ObjectGetBody tired it and it works.

if PXCp_ObjectGetDictionary returns 0 for dictionary ref then call PXCp_ObjectGetBody?

Sorry for wasting your time I got so involved in implementing i didn't have time to write back and tell you i found it :roll:
User avatar
Lzcat - Tracker Supp
Site Admin
Posts: 677
Joined: Thu Jun 28, 2007 8:42 am

Re: Unable to read \Annots to get file attachment from page

Post by Lzcat - Tracker Supp »

truane wrote:if PXCp_ObjectGetDictionary returns 0 for dictionary ref then call PXCp_ObjectGetBody?
You asking why PXCp_ObjectGetDictionary return 0 when object does not contain dictionary? It was not good design in old SDK which is no longer developed, so this behavior will be not changed. But you always can use PXCp_ObjectGetBody and then PXCp_VariantGetType to check what is in object.
HTH.
Victor
Tracker Software
Project manager

Please archive any files posted to a ZIP, 7z or RAR file or they will be removed and not posted.
Post Reply