Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon May 08, 2023 1:39 pm

Hi,
I was trying to use Spire.PDF to place a digital signature at a dynamic locaiton i.e where ever there's an instance of "Signature:-----" on the pdf document. I have tired searching for the term "Signature:-----" and place the signature by using the following code:

Dim result As PdfTextFindCollection = doc.Pages(0).FindText("Signature:", TextFindParameter.WholeWord)
....
Dim y As Single = result.Finds(0).TextBounds(0).Y
Dim x As Single = result.Finds(0).TextBounds(0).Right + 10
Dim location = New PointF(x - 345.2, -y + 20)
signature.Location = location

When ever I try to pass the coordinates values from the variables x and y to the 'signature.location' property the value is changing hence the calculations that you see for the value of x and y but they aren't constant, they keep changing for other instances' location.
The questions that i have are as follows:
1. how do I pass the values of the coordinates from y and x without any changes in value?

2. Is there any other way to place a signature in desired location? the goal is to place the digital signature beside the "Signature:-----"

3. How do I use Spire.PDF to find an area of whitespace( a rectangular area) where I can place the signature on the pdf in the proximity of "Signature:-----" ?

vinayjawadagi
 
Posts: 2
Joined: Mon May 08, 2023 1:28 pm

Tue May 09, 2023 5:48 am

Hi,

Thanks for your inquiry.
Please note that our PDF is drawn on a canvas and we draw specified text, images, and other elements onto it, it may be difficult to determine if a particular area is blank or not.

To draw on a specific location, we need to be provided with precise coordinates to render the desired content. As for your first question, we would appreciate it if you could provide us with more information or a reference screenshot so that we can better understand the issue you are facing.

Please feel free to describe the desired effect in detail so that we can help you find a solution. We apologize for any inconvenience caused by this matter and thank you for your cooperation.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Wed May 10, 2023 10:11 am

Hi thank you for the quick response.
To draw on a specific location, the code that i'm trying is:
Code: Select all
         Dim y As Single = 100
         Dim x As Single = 110
         Dim location = New PointF(x, y)
         signature.Location = location


And the issue is that the values of x and y are not being assigned properly as 100 and 110 respectively and are instead being assigned as 455.2 and -80 respectively(added a screenshot while debugging as attachment). please let me know if i'm doing something wrong.

I have also tried assigning the values of x and y directly to signature.Location but the same thing happens.

Since there's no way to place the digital signature at a whitespace, All that im looking for is a way to place the Signature(or Multiple Signatures) at the end of content at the last page of the pdf, if there's not enough space then create a new page and add the signature/signatures in the new page. will the be possible to do? If so, can you please provide me with the code if possible?

P.S If it helps, I'm using the NuGet package FreeSpire.PDF version 8.6.0

Thanks,
Vinay

vinayjawadagi
 
Posts: 2
Joined: Mon May 08, 2023 1:28 pm

Thu May 11, 2023 6:14 am

Hi,

Thanks for your feedback.
For your first issue, I did a test with your code, using the free version, but I did not reproduce this issue, the values were assigned correctly, see attached screenshots for reference. The values in your screenshot are viewed after the assignment operation is completed? Could you please share us with your full code? Thanks for your assistance.
debug.png

For your second issue, currently, there is no way to achieve this. Thanks for your understanding.

If you have any further questions or concerns, please do not hesitate to contact us.

Best regards,
Triste
E-iceblue support team
User avatar

Triste.Dai
 
Posts: 1000
Joined: Tue Nov 15, 2022 3:59 am

Return to Spire.PDF

cron