attachments

Community Beginner ,
Feb 11, 2019 Feb 11, 2019

Copy link to clipboard

Copied

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.

TOPICS
Acrobat SDK and JavaScript

Views

213

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

1. Number of pages of the attached file.

2. The destination of the attached file.

I want to ask 1,2.

test.jpg

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 12, 2019 Feb 12, 2019

Copy link to clipboard

Copied

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)
{
      char  theBufferPtr[1024];
      PDFileAttachment fileAttachment = PDFileAttachmentFromCosObj(value);
      ASStm asStm = PDFileAttachmentOpenStream( fileAttachment);
      ASInt32 theItemsRead = ASStmRead( theBufferPtr, sizeof( char ), 1024, asStm );
      AVAlertNote ( theBufferPtr);
       if (asStm){
            ASStmClose(asStm);
       }
}

From now on how can you be asked as follows?
ASInt32 lastPage = PDDocGetNumPages (pddoc);
PDNameTree pdNT = PDDocGetNameTree (pddoc, ASAtomFromString ("Dests"));

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Feb 13, 2019 Feb 13, 2019

Copy link to clipboard

Copied

LATEST

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines