Result of Convert method

Hi.

I am currently evaluating Aspose.PDF.

Basically, I want to be able to convert existing PDF to PDF/A-2b and Words documents to PDF/A-2a (will be testing Aspose.Words for that).

Early in my testing, I noticed some strange behavior. I assumed that pdfDocument.Convert would return true if the conversion was a success and false otherwise.

Using a very simple pdf document (a word doc saved as a normal PDF from within word, attached here), I tried this :

if (pdfDocument.Convert(logFile, PdfFormat.PDF_A_1A, ConvertErrorAction.Delete))
pdfDocument.Save(outPath);

assuming it would return false, because converting a PDF to PDF/A-1a should be nearly impossible, according to Adobe. But then the result of the call is true...

Problem is, the result file is not even claiming to be a PDF/A and sure fails Adobe preflight validation.

After the call to Convert, before saving the document, if I call Validate, I get a false indicating the new document isn't compliant. But as the documentation states that convert call validate, I would not have tought about calling it afterwards.

Doing the same thing with a scanned document seems to be OK and a valid PDF/A-1a is generated... which could be a bit weird, understanding that a scanned document has no structured information to be preserved as an "a" conformity should do. I guess this has more to do with using the product in a sensible way...

In real life, I would only produce PDF/A-1a from Word documents, but I would like to be sure what return values to expect from the methods, if I'm using the api in the correct way and most of all, knowing I can rely on the result of the convert method.

Regards
Jerome

Hi Jerome,


Thanks for your inquiry. We have noticed that Convert() is not returning actual result, so logged an investigation ticket PDFNEWNET-38213 in our isuse tracking system for further investigation and resoltuion. We will notify you as soon as it its resolved.

Moreover, for time being as a workaround you can save converted PDFA to stream, use validate method and proceed according to results. Please check sample code snippet as following.

Aspose.Pdf.Document
pdfDocument = new Aspose.Pdf.Document(myDir + “PDFWord.pdf”);<o:p></o:p>

pdfDocument.Convert(new MemoryStream(), Aspose.Pdf.PdfFormat.PDF_A_1A, Aspose.Pdf.ConvertErrorAction.Delete);

MemoryStream ms = new MemoryStream();

pdfDocument.Save(ms);

pdfDocument = new Document(ms);

bool pdfA = pdfDocument.Validate(new MemoryStream(), PdfFormat.PDF_A_1A);

Console.WriteLine(pdfA);

Console.ReadKey();

if (pdfA)

{

pdfDocument.Save(myDir+"PDFtoPDFA1a.pdf");

}



We are sorry for the inconvenience caused.

Best Regards,

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan

The issues you have found earlier (filed as PDFNET-38213) have been fixed in Aspose.PDF for .NET 24.2.