Free Support Forum - aspose.com

I want a signed and pdfa document

Hi,
I am using Aspose.Pdf version 7.1.0
If I create a PDF document and convert it to PDF/A, the library do it correctly.
However, if this PDF/A document is signed with a certificate, the PDF/A is lost, and if I convert it to PDF/A, again, the sign is no longer valid.
How I can get a signed document and PDF/A?
Thanks


Here is my code:

'license
Dim licensePdf As New Aspose.Pdf.License
licensePdf.SetLicense(“Aspose.Pdf.lic”)

'create a sample pdf
Dim pdf1 As New Aspose.Pdf.Generator.Pdf
Dim sec1 As Aspose.Pdf.Generator.Section = pdf1.Sections.Add()
Dim table1 As Aspose.Pdf.Generator.Table = New Aspose.Pdf.Generator.Table()
sec1.Paragraphs.Add(table1)
table1.ColumnWidths = “70 2cm”
Dim row1 As Aspose.Pdf.Generator.Row = table1.Rows.Add()
Dim cell1Row1 As Aspose.Pdf.Generator.Cell = row1.Cells.Add(“ColumnsSpan = 2”)
cell1Row1.ColumnsSpan = 2
cell1Row1.Border = New Aspose.Pdf.Generator.BorderInfo(CType(Aspose.Pdf.Generator.BorderSide.All, Integer), 0.5)
Dim row2 As Aspose.Pdf.Generator.Row = table1.Rows.Add()
Dim cell1Row2 As Aspose.Pdf.Generator.Cell = row2.Cells.Add(“cell1”)
cell1Row2.Border = New Aspose.Pdf.Generator.BorderInfo(CType(Aspose.Pdf.Generator.BorderSide.All, Integer), 0.5)
Dim cell2Row2 As Aspose.Pdf.Generator.Cell = row2.Cells.Add(“cell2”)
cell2Row2.Border = New Aspose.Pdf.Generator.BorderInfo(CType(Aspose.Pdf.Generator.BorderSide.All, Integer), 0.5, New Aspose.Pdf.Generator.Color(“Red”))
Dim oPdf As New IO.MemoryStream
pdf1.Save(oPdf)

'to pdf/a
Dim log As New IO.MemoryStream
Dim pdfAStream As New IO.MemoryStream
Dim oPdfA As New Aspose.Pdf.Document(oPdf)
oPdfA.Convert(log, Aspose.Pdf.PdfFormat.PDF_A_1B, Aspose.Pdf.ConvertErrorAction.None)
oPdfA.Save(“d:\test_pdfa.pdf”) 'it´s pdf/a ok
oPdfA.Save(pdfAStream)

'sign
Dim opdf2 As IO.Stream = New IO.FileStream(“d:\test_pdfa.pdf”, IO.FileMode.Open, IO.FileAccess.Read)
Dim cert As IO.Stream = New IO.FileStream(“d:\cert.pfx”, IO.FileMode.Open, IO.FileAccess.Read)
Dim pdfSign As New Aspose.Pdf.Facades.PdfFileSignature()
pdfSign.BindPdf(
opdf2)
Dim rect As New System.Drawing.Rectangle(10, 10, 200, 100)
Dim signature As New Aspose.Pdf.InteractiveFeatures.Forms.PKCS7(cert, “password”) ’ PKCS#1
pdfSign.Sign(1, “Reason”, “Contact”, “Location”, True, rect, signature)
Dim outputStream As New IO.MemoryStream
pdfSign.Save(“d:\test_signed_but_not_pdfa.pdf”) 'test the pdf: it´s signed, but not pdf/a
pdfSign.Save(outputStream)


Pd: If i save to stream (with pdfSign) and then to file, the document-file dont have the sign.


Hi Fargom,


Thanks for using our products.

Can you please share some sample PDF documents so that we can test the scenario at our end. We are sorry for this inconvenience.

Hi,

I create the PDF in the code. Using this PDF, or another, the library fail.

Hi Fargom,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for the feedback.

I am able to reproduce your mentioned issue after an initial test. Your issue has been registered in our issue tracking system with issue id: PDFNEWNET-34101. You will be notified via this forum thread regarding any updates against your issue.

Sorry for the inconvenience,

PDF/A-1a and PDF/A-1b can’t have support for signed documents according to the standard. Aspose would need to provide PDF/A-2 compliance in order to have digital signatures and other enhancements.

Is this feature planned in the short-term? We are using Aspose.Words and Aspose.PDF in production and we plan to add digital signatures to our legal documents which must be archived in PDF/A-2.
Please add this account to the notification service for this feature.

Hi Javier,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

<o:p> </o:p>

Thank
you for the details.<o:p></o:p>

<o:p> </o:p>

I
have created a new feature request in our issue tracking system with issue id:

PDFNEWNET-34201.
Our development team will further look into this feature and see if this
feature can be supported in near future. We will notify you via this forum
thread regarding any updates against the new feature request.<o:p></o:p>

<o:p> </o:p>

Sorry
for the inconvenience,<o:p></o:p>

The issues you have found earlier (filed as PDFNEWNET-34101) have been fixed in Aspose.Pdf for .NET 7.4.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

thanks a lot
works perfect

The issues you have found earlier (filed as PDFNEWNET-34201) have been fixed in Aspose.Pdf for .NET 7.5.0.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.