Hi
I’m converting a PDF to PDF/A-2b, but it ends up with incorrect glyph width information, causing the letters to be spaced too far from each other.
The same error occurs in these cases:
PDF to PDF/A-1b
PDF/A-1b version of this file to PDF/A-2b
PDF/A-1b to PDF/A-2b (might not be a useful conversion, but still).
I also get a validation error from veraPDF (https://verapdf.org/), the PDF/A validation library that we use.
Here’s one of the validation errors (there are 13 of these in total):
VeraPDFValidation(ruleId=RuleId(specification=ISO 19005-2:2011, clause=6.2.11.5, testNumber=1), message=For every font embedded in a conforming file and used for rendering, the glyph width information in the font dictionary and in the embedded font program shall be consistent., location=Location(level=CosDocument, context=root/document[0]/pages[0](3 0 obj PDPage)/contentStream[0](11 0 obj PDContentStream)/operators[11]/usedGlyphs[0](LVOMWA+000aa1+Arial LVOMWA+000aa1+Arial 1 0 0)))
Here’s the conversion code (kotlin):
val pdfOptions = PdfOptions()
pdfOptions.pdfFormat = PdfFormats.PdfA_2B
val convertOptions = PdfConvertOptions()
convertOptions.format = PdfFileType.Pdf
convertOptions.pdfOptions = pdfOptions
val byteArrayInputStream = { ByteArrayInputStream(documentFromUrl) }
val converter = Converter(byteArrayInputStream)
val pdfOutputStream = ByteArrayOutputStream()
val pdf = { pdfOutputStream }
converter.convert(pdf, convertOptions)
We are using Groupdocs.Conversion 24.6 (java).
I have attached the input pdf in PDF 1.6 format w/embedded fonts, and the resulting PDF/A-2b.
input_pdf_16.pdf (9.6 KB)
result_pdfa2b.pdf (9.9 KB)
@clekroken
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): CONVERSIONJAVA-2458
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hello @clekroken
We sincerely apologize for the delay in investigating your query. After verifying your conversion scenario on GroupDocs.Conversion for Java 24.11, we couldn’t detect any significant differences in glyph widths in the file result_pdfa2b.pdf. Could you reconfirm this on your side?
For non-Windows systems, font-related issues might result from missing fonts. To fix this, GroupDocs.Conversion for Java provides ConverterSettings
, which lets you specify the folder containing the required fonts. Please see the example below for implementation details.
ConverterSettings converterSettings = new ConverterSettings();
converterSettings.setFontDirectories(Arrays.asList("your font folder"));
Converter converter = new Converter("your document path", loadOptions, converterSettings);
Hi @evgen.efimov
Thanks for the reply. I will test this with GroupDocs.Conversion for Java 24.11, and verify the result.
Is it possible to only use fonts from specified font directories? This would be useful for testing locally, where I have a lot of fonts that aren’t installed on the application servers.
Hello @clekroken
Unfortunately, it is not possible to use only the fonts from the specified folder at the moment. By default, the conversion process uses locally installed fonts, and the setFontDirectories()
option only allows you to specify additional font paths for fonts that are not locally installed.
If you have any further questions, please do not hesitate to contact us again.
Sorry for the slow reply. I got quite busy with other issues.
VeraPDF still reports the same validation errors from VeraPDF with GroupDocs.Conversion 24.11. In this case I’ve attempted to convert the file to PDFA-1b.
This file has embedded fonts, so I don’t really want to change them.
I got the same errors from this online validator: PDF Tools Online - Validate PDF
The width for character 1 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 2 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 3 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 4 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 5 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 6 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 7 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 8 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 9 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 10 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 11 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 12 in font ‘ORSTFN+000aa1+Arial’ does not match.
The width for character 13 in font ‘ORSTFN+000aa1+Arial’ does not match.
The document does not conform to the requested standard.
The document contains fonts without embedded font programs or encoding information (CMAPs).
The document does not conform to the PDF/A-1b standard.
Hello @clekroken ,
Thank you for your clarifications.
It seems that while the fonts are not changing, the letter spacing differs after conversion, which likely leads to the document validation issues.
We will need some additional time to investigate this issue further. We’ll get back to you as soon as we have any updates.