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

How i to use PDDocCreatePDCollection function in sdk >9.0

New Here ,
Sep 19, 2017 Sep 19, 2017

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
2.3K
Translate
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

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

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?

Translate
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

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

Translate
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

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?

Translate
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

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?

Translate
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

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.

Translate
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

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

Translate
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

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

Translate
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

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).

Translate
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

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...

Translate
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

No,I'm replace the all sdk file .

Translate
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

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

Translate
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

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?

Translate
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

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.

Translate
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

Thank you so much.

I have learn more from this

Translate
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

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

Translate
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

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.

Translate
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

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

Translate
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
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.

Translate
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