Hi,
I am working on converting digitally signed PDFs to PDF/A. To that end, I need to remove the digital signature from PDF, and add only its visualization back to the new document I am creating. I tried to do this with the ExtractImage() method, like so:
foreach (Aspose.Pdf.Forms.Field field in inputPDF.Form)
{
var sf = field as Aspose.Pdf.Forms.SignatureField;
if (sf != null)
{
using (Stream imageStream = sf.ExtractImage())
{
if (imageStream != null)
{
using (System.Drawing.Image image = Bitmap.FromStream(imageStream))
{
image.Save(outFile, System.Drawing.Imaging.ImageFormat.Jpeg);
}
}
}
}
}
But my digital signature contains an image together with some text, and the ExtractImage method only returns the background image. Is there any way I can get the signature visualization image together with text from the PDF?
Thanks in advance for your help.
Hi Eva,
Nayyer,
please find attached an example of a signed PDF such as I use. You can see the digital signature in the upper right corner of the first page.
The code snippet I posted earlier (for extracting the signature image) only returns the grey background. What I would like to have it return is the logo image (in the upper left corner of the grey rectangle), the text and the grey background image.
Thank you for your help.
I am replying to myself because I have discovered something interesting: if I convert the attached PDF to PDF/A like this:
var pdfaConvert = new Aspose.Pdf.Document(dataStream);
pdfaConvert.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
digital signatures are stripped from the resulting PDF/A, but their images (visualizations) remain, regardless of whether they are image, text or a combination thereof.
Is this expected behaviour? If not, please don’t fix it since it’s very useful.
Hi Eva,Eva_M:
Nayyer,
please find attached an example of a signed PDF such as I use. You can see the digital signature in the upper right corner of the first page.
The code snippet I posted earlier (for extracting the signature image) only returns the grey background. What I would like to have it return is the logo image (in the upper left corner of the grey rectangle), the text and the grey background image.
Thank you for your help.
Hi Eva,Eva_M:
I am replying to myself because I have discovered something interesting: if I convert the attached PDF to PDF/A like this:
var pdfaConvert = new Aspose.Pdf.Document(dataStream);
pdfaConvert.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
digital signatures are stripped from the resulting PDF/A, but their images (visualizations) remain, regardless of whether they are image, text or a combination thereof.
Is this expected behaviour? If not, please don't fix it since it's very useful.