Invalid argument error for AddAttachment

PDF-XChange Viewer SDK for Developer's
(ActiveX and Simple DLL Versions)

Moderators: PDF-XChange Support, Daniel - PDF-XChange, Chris - PDF-XChange, Sean - PDF-XChange, Vasyl - PDF-XChange, Ivan - Tracker Software, Stefan - PDF-XChange

miromr
User
Posts: 59
Joined: Sat May 09, 2009 3:05 pm

Invalid argument error for AddAttachment

Post by miromr »

Hi,
what is wrong?
in this code?
Thank Miro

int docId;
PDFX2.OpenDocument(@"C:\AAA\aaa.pdf", "", out docId, 0);
Object dOut=null;
object[] dIn = new object[3];
dIn[0] = @"C:\AAA\bbb.pdf";
dIn[1] = "Attachment";
dIn[2] = "Description" ;
try
{
PDFX2.DoVerb("Document[0]", "AddAttachment", dIn, out dOut, 0); <--------- "Invalid argument" error
}
catch (Exception ex)
{

ShowErrorMessage(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
}
PDFX2.CloseAllDocuments();
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Invalid argument error for AddAttachment

Post by Stefan - PDF-XChange »

Hello miromr,

I believe that the docID you are trying to pass to the DoVerb method is your problem. Please try replacing that with the docID variable from earlier in your code :)

Best,
Stefan
miromr
User
Posts: 59
Joined: Sat May 09, 2009 3:05 pm

Re: Invalid argument error for AddAttachment

Post by miromr »

Hi Stefan
problem still persists:

private void button1_Click(object sender, EventArgs e)
{
PDFX2.OpenDocument(@"C:\AAA\aaa.pdf", "", out hndDoc, 0);
Object dataOut = null;

Object[] dataIn = new object[3];
dataIn[0] = @"C:\AAA\bbb.pdf";
dataIn[1] = "Attachment";
dataIn[2] = "Description";
try
{
PDFX2.DoVerb("Document[0]", "AddAttachment", dataIn, out dataOut, (int)PXCVA_Flags.PXCVA_NoUI);
}
catch (Exception ex)
{
ShowErrorMessage(System.Runtime.InteropServices.Marshal.GetHRForException(ex));
}
PDFX2.CloseAllDocuments();
}

Thank Miro
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Invalid argument error for AddAttachment

Post by Stefan - PDF-XChange »

Hello Miro,

Why don't you try the
DoDocumentVerb(docId, NULL, "AddAttachment", DataIn ...
method?

Best,
Stefan
miromr
User
Posts: 59
Joined: Sat May 09, 2009 3:05 pm

Re: Invalid argument error for AddAttachment

Post by miromr »

Yes thank you very much Stefan! :D
User avatar
Stefan - PDF-XChange
Site Admin
Posts: 19885
Joined: Mon Jan 12, 2009 8:07 am

Re: Invalid argument error for AddAttachment

Post by Stefan - PDF-XChange »

Pleasure Miro! :)

Cheers,
Stefan