• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How i to use PDDocCreatePDCollection function in sdk >9.0

New Here ,
Sep 19, 2017 Sep 19, 2017

Copy link to clipboard

Copied

I want to create a PDCollection.

In sdk 9.0 i use as fallow

PDDoc newDoc = PDDocCreate();

PDCollection pdCollect = PDDocCreatePDCollection(newDoc);

...

it's ok

but when i use sdk > 9.0

PDDocCreatePDCollection will return error.

it's come an error : error Parameters

TOPICS
Acrobat SDK and JavaScript

Views

1.5K

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

correct answers 1 Correct answer

LEGEND , Sep 21, 2017 Sep 21, 2017

Hmm. It's hard to believe, but Adobe seem to have messed this up.

In the Acrobat 9 SDK we find in PDProcs.h a selection of routine definitions

NPROC(void, PDFileAttachmentSetFieldText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(ASBool, PDFileAttachmentGetFieldText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(void, PDFileAttachmentSetFieldNumber, (PDFileAttachment attachment, ASAtom fieldID, float number))

NPROC(ASBool, PDFileAttachmentGetFieldNumber, (PDF

...

Votes

Translate

Translate
Adobe Employee ,
Sep 19, 2017 Sep 19, 2017

Copy link to clipboard

Copied

Should work exactly the same way.

Are you using DURING/HANDLER blocks to check for errors? Did you do a PDCollectionIsValid() to check the result?

Votes

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
New Here ,
Sep 19, 2017 Sep 19, 2017

Copy link to clipboard

Copied

PDCollectionIsValid checks if a PDCollection is valid. but i call PDDocCreatePDCollection has failed

my code is like this.

when i compile with sdk 9.0 it's work ok. but if use sdk x or >x it's will come this error

PDDoc newDoc = PDDocCreate();
DURING
PDCollection pdCollect = PDDocCreatePDCollection(newDoc);
HANDLER

  // exception handling
  char errorMsg[256];
ASGetErrorString (ASGetExceptionErrorCode(), errorMsg, 256);
// if(aspItem!=NULL) ASFileSysReleasePath(fileSys, aspItem);
// if(theFolder!=NULL) ASFileSysReleasePath(fileSys, theFolder);

// display an error message.
if(ASBoolToBool(bEcho)==true) {//
  AVAlertNote (errorMsg);
}
END_HANDLER

....

other code..

errorMsg just display Parameters is error

Votes

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
Explorer ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Are you using the same version of Acrobat to match the SDK when you move to a higher version of the SDK? Otherwise which version of Acrobat are you using? Is this Mac or PC?

Votes

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
New Here ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

yeah, thanks

i use the same version Acrobat to match the SDK  will be ok.

but how to compile one plus-ins for all version Acrobats

or i need to make plus-ins for one by one?

Votes

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
LEGEND ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

Please give more details of exact versions. Which version of Acrobat and which version of the SDK together fail? Which ones work? It's not enough to talk only of SDK version.

Votes

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
New Here ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

if i compile puls-ins with sdk XI,it  works ok on Acrobat version>9.0 all.

but it will be failed in 9.0.

if i comlile it with sdk 9.0,it works failed on version >9.0. it will be only support  Acrobat 9.0

Votes

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
Explorer ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

When you move between SDKs are you also replacing PIMain.c in your code to match each SDK?

Votes

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
LEGEND ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

Hmm. It's hard to believe, but Adobe seem to have messed this up.

In the Acrobat 9 SDK we find in PDProcs.h a selection of routine definitions

NPROC(void, PDFileAttachmentSetFieldText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(ASBool, PDFileAttachmentGetFieldText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(void, PDFileAttachmentSetFieldNumber, (PDFileAttachment attachment, ASAtom fieldID, float number))

NPROC(ASBool, PDFileAttachmentGetFieldNumber, (PDFileAttachment attachment, ASAtom fieldID, float *number))

In a later SDK we find

NPROC(void, PDFileAttachmentSetFieldText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(void, PDFileAttachmentSetFieldStyledText, (PDFileAttachment attachment, ASAtom fieldID, ASConstText text))

NPROC(ASBool, PDFileAttachmentGetFieldText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(ASBool, PDFileAttachmentGetFieldStyledText, (PDFileAttachment attachment, ASAtom fieldID, ASText text))

NPROC(void, PDFileAttachmentSetFieldStyle, (PDFileAttachment attachment, ASAtom fieldID, ASConstCab styles))

NPROC(ASBool, PDFileAttachmentGetFieldStyle, (PDFileAttachment attachment, ASAtom fieldID, ASCab styles))

NPROC(void, PDFileAttachmentSetFieldNumber, (PDFileAttachment attachment, ASAtom fieldID, float number))

NPROC(ASBool, PDFileAttachmentGetFieldNumber, (PDFileAttachment attachment, ASAtom fieldID, float *number))

This is absolutely against how the header files must be maintained. Because later in the same header file we find the definition of PDDocCreatePDCollection. Why does it matter? Because each NPROC adds 1 to the current HFT entry. This means that if we use any routine after this point in PDProcs we will be calling the wrong code, with all sorts of bad consequences.

The easy way to resolve this is to build two plug-ins. Building one plug-in is not actually impossible, but is going to need very low level and detailed understanding of how HFTs work. I wouldn't like to do it (though I would if I had to).

Votes

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
New Here ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Thanks,You mean if we call a proc ,the Arcobat just call it as Index not by name.

So we if call PDDocCreatePDCollection with different sdk in same Acrobat it will don't have same result?

I 'm  building two plug-ins...

Votes

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
New Here ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

No,I'm replace the all sdk file .

Votes

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
New Here ,
Sep 20, 2017 Sep 20, 2017

Copy link to clipboard

Copied

i check it again.

the plus-ins compile it with sdk >9.0 ,the PDDocCreatePDCollection will be work ok in version >9.0 Acrobat

so it's obvious sdk 9.0 & >9.0 has some difference .

thanks

Votes

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
LEGEND ,
Sep 21, 2017 Sep 21, 2017

Copy link to clipboard

Copied

SDKs are not backwards compatible. Something compiled with SDK 11 should not even load in Acrobat 10 or 9. But they should be forwards compatible except across architecture changes. (Such as Acrobat DC on Mac which needs the DC headers).

So, something compiled with SDK 9 should work in Acrobat 10,11, and on Windows DC. It doesn't?

Votes

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
LEGEND ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Acrobat calls all plugin methods by a number, that is correct. (details: study "HFT"). The number comes from the header files and has to match the number used inside that version of Acrobat.

Adobe have been very, very careful to make sure the numbers never change. This is quite simple: new methods are always added to the end of the list. Unfortunately, it seems someone at Adobe was working in the header files and didn't know the rules. It affects all the methods in PDProcs.h which appear in the SDK 9 starting with PDFileAttachmentGetFieldText. This is not many methods and you may be the first to discover it. There is nothing that can be done to fix the mistake.

Votes

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
New Here ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Thank you so much.

I have learn more from this

Votes

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
Explorer ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

So is there someone who can now record this as a bug at Adobe and get this fixed. Leonard - are you onto this one?

Votes

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 Expert ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Michael, to make sure that Leonard sees this, you need to make a formal "mention" (start with the @ character and then start to type a forum user name, and then pick from the list. Sometimes you have to type the full name): lrosenth​ - this way he will get a notification.

Votes

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
Explorer ,
Sep 22, 2017 Sep 22, 2017

Copy link to clipboard

Copied

Karl Karl Heinz Kremer​, thanks for the heads up.

Votes

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
Adobe Employee ,
Sep 23, 2017 Sep 23, 2017

Copy link to clipboard

Copied

LATEST

There was one bad version which has the problem you describe – but AFAIK, if you use the last dot releases of each version 9.x, 10.x, along with the correct SDK, everything is fine.

However, as noted earlier in the thread – SDKs are only forward compatible not backwards.

Votes

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