Print Page | Close Window

Insert signature field with PDFPoints coordinates

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=2751
Printed Date: 10 Nov 24 at 9:33PM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Insert signature field with PDFPoints coordinates
Posted By: AlessandroRimoldi
Subject: Insert signature field with PDFPoints coordinates
Date Posted: 10 Oct 13 at 8:49AM
Hello, i must create a signature field or add an image to a PDF and the destination coordinate and values for size are in PDFPoints. How can i do?
Thank You!



Replies:
Posted By: Ingo
Date Posted: 11 Oct 13 at 12:31PM
Hi Alessandro!

I want to create a car ... please tell me how to do ;-)
There are "first-step-guids" online and you have documentation with your installation.
Please read inside the developer guide and the online reference.
Start with an easy app... step by step... and then you should post about special problems with one function or another function ... :)

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: Rowan
Date Posted: 11 Oct 13 at 1:01PM
Hi Alessandro,

Thanks for your post.

The information you need is in the Developer Guide for Debenu Quick PDF Library (provided with the installer).

Origin point for drawing operations

The origin has coordinates of “0,0” and is the starting point for finding all other points. The origin 
point for a page in a PDF typically starts at a page corner. The default origin for Debenu Quick 
PDF Library is the bottom left page corner.
 
Using the SetOrigin function in Debenu Quick PDF Library you can change the point of origin to 
be any page corner (bottom left, top left, top right, bottom right).
 
By default calling DrawText(10, 10, “Test”) will result in the text being drawn at 10 points in from 
the left of the page and 10 points up from the bottom of the page, but if you call SetOrigin(1) 
prior to DrawText then the text will be drawn at 10 points in from the left of the page and 10 
points down from the top of the page because passing the value 1 to the Origin parameter for 
the SetOrigin function changes the origin to top left of the page.
 
The default point of origin in Adobe Acrobat was the bottom left page corner up until Acrobat 
8, at which point Adobe switched the point of origin to the top left page corner. As mentioned 
above, you can set Debenu Quick PDF Library to use any page corner in a PDF.
In version 7.25 of Debenu Quick PDF Library we added a new function called NormalizePage 
that moves and/or rotates the contents of the page so that subsequent drawing operations are 
at the expected position on the page. All the page boundary boxes are adjusted to the physical 
size of the page and the page's rotation attribute is reset to zero.

Measurement units

In PDF the coordinate system is called default user space. The default for the size of the unit in 
default user space (1/72 inch) is approximately the same as a point, a unit widely used in the 
printing industry. It is not exactly the same, however; there is no universal definition of a point.

Lastly, here is a knowledge base article for http://www.debenu.com/kb/add-visual-digital-signature-to-a-pdf-programmatically/" rel="nofollow - adding a digital signature field and and http://www.debenu.com/kb/convert-an-image-to-a-pdf-programmatically/" rel="nofollow - adding an image to a PDF programmaticaly.

Cheers,
- Rowan.


Posted By: Marat.Chariev
Date Posted: 26 Oct 13 at 10:04PM

I decided to post my question here since you guys talking about placing digital signature into existed PDF file.

Here are the steps I follow:

Create an instance of the library :

 lnInstanceId = DPLCreateLibrary()

 

Get selected document (default) ID:

lnSelectedDocumentID = DPLGetDocumentID(lnInstanceID, 1)

 

Set origin coordinates (Top-Left):

lnResult = DPLSetOrigin(lnInstanceID, 1)

 

Set other settings:

 

lnResult = DPLSetNeedAppearances(lnInstanceID, 1)

lnResult = DPLSetPageDimensions(lnInstanceID, lnPhysicalPaperWidth, lnPhysicalPaperLength)

lnResult = DPLSelectPage(lnInstanceID, 1)

lnLayer = DPLNewContentStream(lnInstanceID)

 

Then I draw the text into PDF file and save it as lcPDFFile:

 

lnResult = DPLSaveToFile(lnInstanceId, lcPDFFile)

lnResult = DPLRemoveDocument(lnInstanceId, lnSelectedDocumentID)

 

After that I open newly created PDF file in order to place “visual” digital signature using same instance of the library:

 

lnSignProcessID = DPLNewSignProcessFromFile(lnInstanceID, tcFileName, lcPassword)

 

Set origin coordinates (Top-Left) again, because after DPLRemoveDocument() command it was reset to 0: lnResult = DPLSetOrigin(lnInstanceID, 1)

Now my origin coordinates are set to Top-Left. But when I try to bound field it shows it in the wrong place (looks like it uses default origin coordinates (Bottom-Left)) :

 

lnResult = DPLSetSignProcessPFXFromFile(lnInstanceID, lnSignProcessID, lcPFXFileName, lcPFXFilePassword)

lnResult = DPLSetSignProcessInfo(lnInstanceID, lnSignProcessID, lcReason, lcLocation, lcContactInfo)

lnResult = DPLSetSignProcessField(lnInstanceID, lnSignProcessID, lcTitleOfFormField)

lnResult = DPLSetSignProcessFieldBounds(lnInstanceID, lnSignProcessID, lnLeft, lnTop, lnWidth, lnHeight)

lnResult = DPLSetSignProcessFieldImageFromFile(lnInstanceID, lnSignProcessID, lcSignatureImageFileName, 0)

 

lnResult = DPLEndSignProcessToFile(lnInstanceID, lnSignProcessID, lcTempFileName)

 

 

Am I missing something?

 

 

 

 

 

 

  




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk