We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

[PDF2PDFA] Pdf to Pdf_A_1B is OK Pdf to Pdf_A_2B is KO

Hello,

I want change format and version of pdf. I use :
Document.Convert(ms, Aspose.Pdf.PdfFormat.PDF_A_1B, Aspose.Pdf.ConvertErrorAction.Delete);
The result is OK for pdf_A_1b but is KO for Pdf_A_2B.

Could you give me an advice or an explain me why its OK for pdf_A_1b and KO for Pdf_A_2B.

Regards

Hello Daniel,


Thanks for contacting support.

I have tested the scenario by converting your PDF document (01.pdf) into mentioned formats and observed that resultant file(s) were unreadable and could not be opened with Adobe Reader. However for the sake of investigation, I have logged an issue as PDFNET-42700 in our issue tracking system. Please note that sometimes issue may be related with specific input file(s), so I have also provide the input document with the logged issue.

We will further investigate the reasons behind this issue and keep you informed on the status of its resolution. Please be patient and spare us little time. We are sorry for the inconvenience.


Best Regards,

Hello,
I checked this ticket and I can see that the PDFNET-42700 status is closed !
Is it corrected ? Or what does mean the Closed,status ? I had no news on this ticket.
Best regards
Daniel STEPHAN
AIRBUS

@CSCT

Thanks for writing us.

We are pleased to inform you that earlier logged issue has been resolved. However, followings are the findings and feedback from our product team regarding the issue, which you were facing.

Input document “01.pdf” has a fonts (i.e “Berlin Sans FB”, “LucidaHandwriting-Italic”) which can be absent on destination computer, and this font absence produces an error "Font is not embedded". This error has a reason cause PDF/A standard requires that all fonts must be embedded into document. Usually it’s not a problem to embed font, but if font is absent then we have a question - what data to embed instead of absent font?

A special option to use font substitution was added into Aspose.Pdf to resolve cases with absent fonts.
This option was included into new class Aspose.Pdf.PdfAOptionClasses.FontEmbeddingOptions - property UseDefaultSubstitution. When this flag is set and some font is absent then Aspose.Pdf will substitute this font using internal default substitution algorithm.

Code snippet to convert input document:

Document doc = new Document(dataDir + "01.pdf");
PdfFormatConversionOptions ops = new PdfFormatConversionOptions(PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
ops.FontEmbeddingOptions.UseDefaultSubstitution = true;
doc.Convert(ops);
doc.Save(dataDir + "01_PDFA.pdf");

Usage of flag UseDefaultSubstitution substitute all the absent fonts automatically. It can be helpful when you do not know what font must be used to substitute absent font. But also it has a risk to damage document representation, cause there can be cases when new font is not fully compatible with source font. So you can use this flag UseDefaultSubstitution on your own risk. :slight_smile:

If you know what font can be used to substitute absent one, you can use another font substitution mechanism - in this case its possible to declare new font directly. Its accomplished with using of property Substitutions of class Aspose.Pdf.Text.FontRepository. Use this property to add substitution for desired font.

Next code snippet converts input document and declares to substitute font “LucidaHandwriting-Italic” with a font “Arial”, if source font “LucidaHandwriting-Italic” will be absent:

Document doc = new Document(dataDir + "01.pdf");
PdfFormatConversionOptions ops = new PdfFormatConversionOptions(PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
FontRepository.Substitutions.Add(new SimpleFontSubstitution("LucidaHandwriting-Italic", "Arial"));
doc.Convert(ops);
doc.Save(dataDir + "01_PDFA.pdf");

In case of any further assistance, please feel free to contact us.

Hello Asad,

I’ve a question regarding your answer.
in fact, regading the code snippet, you mention PDFA_1B in order to substitute the missing font.
But in my case, the conversion to PDFA_1B works properly. The issue is on the same input document transformed to PDFA_2B format.
Is there any difference between PDFA_1B and PDFA_2B regarding the fact that a font is missing in the input ?

Many thanks

@CSCT

Thanks for writing back.

We have also tested the shared approaches while converting PDF document into PDFA_2B format and resultant document has compliance with PDF/A standard and look OK. Please check attached PDFA_1B document and a compliance test report of Adobe Preflight.

01_PDFA_2b_review.pdf
review_2.png (45.3 KB)

In case if you are still facing issue while converting PDF into PDFA_2B, please let us know, so that we can test and log the issue accordingly.