1

I want to create a PDF/A-3 Document and then add an attachment to it.

I tried using the Interop Services.

Dim xl As Microsoft.Office.Interop.Excel.Application = New Microsoft.Office.Interop.Excel.Application

Dim wkb As Microsoft.Office.Interop.Excel.Workbook = xl.Workbooks.Open("C:\SourceFile.xlsx")
        wkb.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, "C:\Test.pdf")

        xl.Quit()

Is there a way to produce a PDF/A-3 compatible file and add an attachment to it without use of external libraries?

If not, what external library are you recommending considering B2B use.

Vad1mo
  • 5,156
  • 6
  • 36
  • 65
llennac
  • 25
  • 4
  • This post might help you out: https://stackoverflow.com/questions/34218658/convert-pdf-to-pdf-a3-or-pdf-a-1-to-pdf-a-3 – tj-cappelletti Aug 20 '19 at 12:13
  • What kind of attachment are you adding? And why is adding that attachment important for you? – Ryan Aug 20 '19 at 18:20
  • Its about a new european standard called "Zugferd". This is for creating bills and similar documents. It requires a PDF/A-3 Document with some XML as MetaData. The metadata contain the fields and the actual PDF acts as a human readable Format. – llennac Aug 21 '19 at 16:44

1 Answers1

1

I tried using the Interop Services.

As @joelgeraci mentioned, if you use newer versions of MS Excel, Office 365 in particular, you can use Interop to get a PDF/A-3a version. Theoretically you could use earlier versions of MS Excel, since a valid PDF/A-1 and PDF/A-2 should also be valid PDF/A-3 files, though you would have to edit the Metadata entry to change the PDF/A conformance level the file claims to be.

Is there a way to produce a PDF/A-3 compatible file and add an attachment to it without use of external libraries?

Technically, you could edit the PDF using .Net, to embed the data, but you would be deep diving into the PDF standard, and making binary changes to the PDF. So in a practical sense, no you need a library to add the attachment.

If not, what external library are you recommending considering B2B use.

PDFTron, the company I work for, has a blog post describing how to make a Zugferd compliant PDF.

As for the Excel to PDF conversion, you could continue to use MS Excel interop as you are, or use our internal converter. By using our internal converter, you could do this process using .NET Core, and therefore on Linux, and avoiding MS Office and MS Windows licensing costs.

Ryan
  • 2,473
  • 1
  • 11
  • 14