You can find attachments using PDDocGetNameTree in Acrobat SDK.
However, I want to find the number of MAX pages and the named destination of the attached file.
Do you mean you want to find the number of pages of each attached file (Do you can get the maximum)?
I don’t understand the second requirement, sorry.
1. Number of pages of the attached file.
2. The destination of the attached file.
I want to ask 1,2.
Ok, you will need to open the file on a PDDoc object. I have never done this, but I feel that the methods PDFileAttachmentFromCosObj and PDFileAttachmentOpenStream would be at the heart of any solution.
You could also process the name tree entries as Cos objects, get an ASStm and open it.
I tried it in the following way, but I am just reading the attached file.
// Procedure called by PDNameTreeEnum
ACCB1 ASBool ACCB2 extractor(CosObj obj, CosObj value, void *clientData)
PDFileAttachment fileAttachment = PDFileAttachmentFromCosObj(value);
ASStm asStm = PDFileAttachmentOpenStream( fileAttachment);
ASInt32 theItemsRead = ASStmRead( theBufferPtr, sizeof( char ), 1024, asStm );
AVAlertNote ( theBufferPtr);
From now on how can you be asked as follows?
ASInt32 lastPage = PDDocGetNumPages (pddoc);
PDNameTree pdNT = PDDocGetNameTree (pddoc, ASAtomFromString ("Dests"));
You have to open a PDDoc on the ASStm object. I don’t know exactly which APIs you will use but that must be part of your solution.
Possibilities include writing a temporary file and opening it, or creating a custom ASFileSys.
If the container PDF is a portfolio the ASFileAttachment APIs are helpful.