Free Support Forum - aspose.com

Converting files to PDF/A

Hello,


We’re trying to convert a (pseudo-)random document to a PDF/A file. Obviously, this will not be possible, since there are restriction. In our current test, we’re working with an Excel file (xlsx) and trying to convert it to a PDF/A 1B file.
We do this using the direct method - save it a pdf and passing PdfSaveOptions - and by first converting it to an tiff and then to a pdf.

The success boolean coming from the convert method claims it went successful, although the pdf tool validator still claims it is not a valid PDF/A. (http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx)

The sample file is attached to the post.
We’re running it on a Windows 7 x64, using .NET Aspose PDF 10.5 and Cells 7.7.2.
The sample code is as follow:

// Load the file
Aspose.Cells.Workbook book = new Aspose.Cells.Workbook(@“C:\Input.xlsx”);
// Convert it directly
book.Save(@“C:\Output 1.pdf”, new Aspose.Cells.PdfSaveOptions() { Compliance = Aspose.Cells.Rendering.PdfCompliance.PdfA1b });

// Convert to a TIFF, and then a PDF/A
using (MemoryStream stream = new MemoryStream())
{
Aspose.Cells.ImageSaveOptions options = new Aspose.Cells.ImageSaveOptions(Aspose.Cells.SaveFormat.TIFF);
options.ImageOrPrintOptions.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionLZW;
book.Save(stream, options);

Bitmap bmp = new Bitmap(stream);

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();
Aspose.Pdf.Page page = pdf.Pages.Add();
page.PageInfo.Margin.Bottom = 0;
page.PageInfo.Margin.Top = 0;
page.PageInfo.Margin.Left= 0;
page.PageInfo.Margin.Right= 0;
page.CropBox = new Aspose.Pdf.Rectangle(0, 0, bmp.Width, bmp.Height);

Aspose.Pdf.Image img = new Aspose.Pdf.Image();
page.Paragraphs.Add(img);
img.ImageStream = stream;

bool success = pdf.Convert(@“C:\Convert Log.xml”, Aspose.Pdf.PdfFormat.PDF_A_1B, Aspose.Pdf.ConvertErrorAction.Delete);
pdf.Save(@“C:\Output 2.pdf”);
}

Are we doing something wrong, overlooking something, or does Aspose simply claim a file to be PDF/A, while it does not meet the standard?

Thanks in advance,
Jeroen

Hi Jeroen,


Thanks for your inquiry. I have tested the scenario using your shared code and verified PDFA1B compliance of output document using Preflight tool of Adobe Acrobat XI and it is validating it successfully. Can you please test the documents with Preflight and share the results?

Please note we follow Adobe Preflight for validating PDF/A conformance. All tools on the market have their own “representation” of PDF/A conformance. Please check this article on PDF/A validation tools for reference. We chose Adobe products for verifying how Aspose.Pdf produces PDF files because Adobe is at the center of everything connected to PDF.

// Load the file<o:p></o:p>

Aspose.Cells.Workbook book = new Aspose.Cells.Workbook(myDir+"Xlsx+-+1w.xlsx");

// Convert it directly

book.Save(myDir + "Xlsx+-+1w_cells.pdf", new Aspose.Cells.PdfSaveOptions() { Compliance = Aspose.Cells.Rendering.PdfCompliance.PdfA1b });

// Convert to a TIFF, and then a PDF/A

using (MemoryStream stream = new MemoryStream())

{

Aspose.Cells.ImageSaveOptions options = new Aspose.Cells.ImageSaveOptions(Aspose.Cells.SaveFormat.TIFF);

options.ImageOrPrintOptions.TiffCompression = Aspose.Cells.Rendering.TiffCompression.CompressionLZW;

book.Save(stream, options);

Bitmap bmp = new Bitmap(stream);

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document();

Aspose.Pdf.Page page = pdf.Pages.Add();

page.PageInfo.Margin.Bottom = 0;

page.PageInfo.Margin.Top = 0;

page.PageInfo.Margin.Left = 0;

page.PageInfo.Margin.Right = 0;

page.CropBox = new Aspose.Pdf.Rectangle(0, 0, bmp.Width, bmp.Height);

Aspose.Pdf.Image img = new Aspose.Pdf.Image();

page.Paragraphs.Add(img);

img.ImageStream = stream;

bool success = pdf.Convert(myDir+"Convert Log.xml", Aspose.Pdf.PdfFormat.PDF_A_1B, Aspose.Pdf.ConvertErrorAction.Delete);

pdf.Save(myDir+"Xlsx+-+1w_pdf.pdf");

}


Please feel free to contact us for any further assistance.

Best Regards,

Ah, that explains a lot. We thought that, since PDA/A is an ISO standard, there is but a single way to conform to it. Apparently, there are multiple interpretations possible, or some of the tools are simply wrong.


Alas, there is nothing we can do about it. We use Aspose - which uses the Adobe standard - to convert files to PDA/A 1B and send the to Kofax Capture - which uses the tool mentioned in the previous post.

We’ll think of a way to work around it.
Thanks,
Jeroen


Hi Jeroen,


Thanks for sharing the details.

As shared earlier, we need to stick to the standards and specifications of PDF documents from Adobe. I am afraid it will be quite difficult to comply the standards from various third party tools because each of these utilities have their own specifications and implementations.

Hi Jeroen,


In addition to above reply, although we follow the Adobe standards, however we have logged a ticket PDFNEWNET-39190 in our issue tracking system to investigate the online PDF validator tool error details. We will share the findings as soon as our product team analyze it.

Best Regards,

Hi Tilal,


I am a colleague of Jeroen and also busy with this issue.
We have converted attached PDF document via the code you already tested but are not sure if this document is PDF/A compliant. We don’t have the means to test it with PreFligth.
Could you test the document for us and give us feedback if this document is PDF/A compliant according to Adobe PreFligth?

Kind regards,

Eric

Hi Eric,


Thanks for your inquiry. I have tested the compliance of your shared PDF document with Adobe Acrobat XI preflight and found that it is not PDFA1a compliant document. Please find attached screenshot for the reference.


Moreover, you are using a quite old version of Aspose.Pdf.Net i.e.9.0 for the conversion. It is recommend to use latest version of Aspose.Pdf for .NET, as later versions have number of fixes and enhancements. Hopefully it will resolve the issue. However if the issue still persist then please share your source PDF document here, we will look into it and guide you accordingly.

We are sorry for the inconvenience caused.

Best Regards,