Problem with SignDocumentUsingPFXW in .NET

PDF-XChange Drivers API (only) V4/V5
This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-XChange Printer Drivers SDK (only) - VERSION 4 & 5 - Please use the PDF-Tools SDK Forum for Library DLL assistance.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
sammydeveille
User
Posts: 1
Joined: Mon Feb 25, 2013 10:14 am

Problem with SignDocumentUsingPFXW in .NET

Post by sammydeveille »

Hello the Tracker support team,

I am trying to sign document via the latest version of the Tracker SDK (4.0.209).
I have created two different certificates using the Sample PDF Viewer provided: certificateTest1.pfx and certificatedTest2.pfx

My findings are that I am able to sign documents using the first certificate, but when using the second, my application freezes on calling the SignDocumentUsingPFXW library function !!

Here is the code of my sample app:
(Visual Studio 2010 - .NET 2.0 (also tested on .NET 3.5))

private void click_event (...)
{
string g_RegKey = "<My Registration Key>";
string g_DevCode = "<My Dev Code>";

string infile = "c:\\document_to_sign.pdf";
string outfile = "c:\\signed_document.pdf";

int handle = -1;

XCPro35_Defs.PXCp_Init(out handle, g_RegKey, g_DevCode);

int iresult = XCPro35_Defs.PXCp_ReadDocumentW(handle, infile, 0);
XCPro35_Defs.PXC_RectF rect4Image = new XCPro35_Defs.PXC_RectF();

// We don't want the signature to be visible on the document, so set it to a small rectangle
rect4Image.left = 0;
rect4Image.right = 0.4;
rect4Image.top = 0.4;
rect4Image.bottom = 0;
IntPtr pdfHandle = new IntPtr(handle);

int signResult = XCPro35_Defs.PXCp_SignDocumentUsingPFXW(handle,
//@"C:\CertificateTest1.pfx", "<My First Password>", 0, ref rect4Image,
@"C:\CertificateTest2.pfx", "<My Second Password>", 0, ref rect4Image,
"MyReasonForSigningThis", "MyLocation", "MyEmail@test.com", "", 0); // I tried with and without using an image set to a jpg - no differences

// Time Stamping
//int tsaResult = XCPro35_Defs.PXCp_SetTSAServerA(handle, "http://adobe-timestamp.globalsign.com/t ... asgnlg5m23", "", "");

int writeResult = XCPro35_Defs.PXCp_WriteDocumentW(handle, outfile, XCPro35_Defs.PXCp_CreationDisposition.PXCp_CreationDisposition_Overwrite, 0);
}

I can send you via email the test certificates I am using. I successfully imported both of them, several times, but cannot figure out why the function freezes on passing it the second certificate.

Can you please advise us, as it will become an important feature we'd like to integrate with.

Regards
Sammy
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Problem with SignDocumentUsingPFXW in .NET

Post by Tracker Supp-Stefan »

Hello Sammy,

Yes please send us both certificates with a link back to this forum topic to
support@pdf-xchange.com

Best,
Stefan
User avatar
Tracker Supp-Stefan
Site Admin
Posts: 17824
Joined: Mon Jan 12, 2009 8:07 am
Location: London
Contact:

Re: Problem with SignDocumentUsingPFXW in .NET

Post by Tracker Supp-Stefan »

Hi Sammy,

Thanks for the sample files and the earlier phone call.
I have already replied to you via e-mail, but also posting here the ticket that we've created for consistency:
#1782: Problem with SignDocumentUsingPFXW in .NET
We will seek to investigate and fix this issue as soon as possible, and will keep you updated via e-mail on the status of the ticket.

Best,
Stefan
User avatar
Ivan - Tracker Software
Site Admin
Posts: 3549
Joined: Thu Jul 08, 2004 10:36 pm
Location: Vancouver Island - Canada
Contact:

Re: Problem with SignDocumentUsingPFXW in .NET

Post by Ivan - Tracker Software »

There is nothing wrong with your certificate.
The problem is because you specified a very small rectangle for the signature (only 0.4 point per 0.4, if you want to make invisible signature, please pass the rectangle with all zeros),
and the library having problem with fit text of the signature into that rectangle.

I have fixed the issue with infinite loop and the fix will be available in the next build.
Tracker Software (Project Director)

When attaching files to any message - please ensure they are archived and posted as a .ZIP, .RAR or .7z format - or they will not be posted - thanks.
Post Reply