简体   繁体   中英

error while converting pdf to pdf/a

I am trying to create a pdf/a file from a pdf file using itext. Everything goes fine and I get a pdf/a file. But when I check it here http://www.pdf-tools.com/pdf/validate-pdfa-online.aspx I get an error like

The width for character 1 in font 'ArialRegular' does not match.
The width for character 2 in font 'ArialRegular' does not match.
The width for character 3 in font 'ArialRegular' does not match.

how could I solve this error?

PdfReader pdfReader = new PdfReader(file);

FontFactory.defaultEmbedding = true;
BaseFont bf = BaseFont.createFont(FONT, BaseFont.CP1252, BaseFont.EMBEDDED);
while (currentpagenumber < pdfReader.getNumberOfPages()) {
    document.newPage();
    currentpagenumber++;
    finalpagenumber++;
    page = pdfAWriter.getImportedPage(pdfReader, currentpagenumber);
    cb.addTemplate(page, 0, 0);
    cb.beginText();
    cb.setFontAndSize(bf, 18);
    cb.showTextAligned(PdfContentByte.ALIGN_CENTER, finalpagenumber+"", 520, 5, 0);
    cb.endText();
    ICC_Profile icc = ICC_Profile.getInstance(new FileInputStream(PROFILE));

this is the basic code. I also tried to find the font used in each page using pdfdictionary .. and tried to embeded it as base font.. but couldnot work..

Never used IText before, but just looking at doing a similar conversion now, and it appears to be a bug in the library and not in the way you are using it. The best option I can give you is to report a bug at: http://sourceforge.net/p/itext/bugs/ The IText mailing list would also be another place to try.

md_5

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM