Add image to PDF Signature appearance? Change text color?

Hello,

I try GemBox.Pdf to digitally sign pdfs.
I get it worked using a Belgian electronic ID Card (pkcs11) thanks to your digital signatures example.

But I’m missing 2 things:

  1. I didn’t find a way to add an image to the signature field appearance. Is it possible?
  2. I want to customize the text color on the signature field, is there a way to do it?

Thanks
Whiletrue

Hi Whiletrue,

Regarding the text color, please try using this latest version from our BugFixes page or NuGet.

We have added the PdfSignatureAppearance.FontColor property, you can use it like this:

PdfSignatureField signatureField = ...

// Get signature appearance settings.
PdfSignatureAppearance signatureAppearance = signatureField.Appearance;

// Set font family to "Times New Roman".
signatureAppearance.FontFamily = new PdfFontFamily("Times New Roman");

// Set font color to red.
signatureAppearance.FontColor = PdfColor.FromRgb(1, 0, 0);

// ...

Regarding the signature image, GemBox.Pdf currently doesn’t provide an easy-to-use API for adding images.
But note that we’re working on this, this feature should be available in the near future (within a month or two).

For now as a workaround, I could provide you a solution that uses GemBox.Document to create any kind of visual appearance that you want (both text and image) which you would then add to a signature field using GemBox.Pdf.
Let me know if you’re interested in this.

Regards,
Mario

Hi Mario,

the image feature is now available? If not, could you provide the solution you proposed Whiletrue to me?
I’ve already Gembox.Document and i’m thinking to buy the Pdf module, but i need the possibility to sign with a visibile image

Thank you,
Stefano

Hi ghostmaster,

A simple API for setting the image to the signature appearance is still not available.

In the meantime, please check the following solution that uses only GemBox.Pdf (using GemBox.Document is not required): Setting appearance of sign field

Hi Mario,

i confirm that with the solution you proposed i can add an image to the signature.
There is a way to put the image on the left and free text on the right, or i have to create an image that has all the information (image+text) i want like a label?

Thank you in advance,
Stefano

Hi,

Currently, you would need to create such an image or use GemBox.Document to create the desired appearance.

Basically, with GemBox.Document you could create whatever PDF content you want and then use it as a signature field appearance with GemBox.Pdf.
For example, take a look at this DigitalSignature.zip example project.

Last, note that in the near future we plan to provide a direct API for doing this with just GemBox.Pdf.

Regards,
Mario

Hi,

We have recently released a new version of GemBox.Pdf which supports specifying both text and image for signature appearance.

The Digitally sign a PDF file with a visible signature example demonstrates how to use the new API improvements.

Regards,
Mario