Aspose.Pdf Font size problem in PDF conversion

Good morning,

I encountered a font size change problem after converting files produced with Microsoft Word (doc, docx, rtf…) to PDF.
In the PDF file the font appears slightly larger than the one in the Word document.
This change of font is problematic for our customers who, sometimes, find files with an extra page or with lines of text, in the case
are at the end of the pages, on the next page.
The fonts are correctly installed in our environments.
I attach a simple example of a doc file with Arial font and the result of the conversion to PDF. You can notice, visually, that in the PDF the font is slightly larger.

The version I’m using is 22.12. I await your response, thank you.

Liberato
provaconversionefont.docx (13,2 KB)

provaconversionefont.pdf (36,2 KB)

@L1b3r0

Could you please provide more details about the specific settings or options you are using during the conversion process? Additionally, are you using any specific fonts or styles that might affect the output?

I’m not using any particular font or style. As you can see from the attached doc file it is a simple Arial font. The problem occurs, however, with any character.

Even trying to convert online from the Aspose website I get a slightly larger font.

During the conversion process I don’t use any special settings this is the piece of code we use:

public void toPdf(OutputStream os) throws Exception {
    if (os == null) {
        throw new IllegalArgumentException("The output stream is null!");
    }
    final ByteArrayOutputStream outputLogStream = new ByteArrayOutputStream();
    doc.convert(outputLogStream,  PdfCompliance.PDFA_FORMAT_A_3A, ConvertErrorAction.Delete);
    if (log.isTraceLevel()) {
        log.trace("toPdf", "PDF/A conversion log: {}", outputLogStream.toString("utf-8"));
    }
    this.doc.save(os);
}

@L1b3r0

The sample output file that you shared is generated using Aspose.Words. However, the code you shared is about converting a PDF document into PDF/A using Aspose.PDF. Can you please clarify if the issue is happening during DOCX to PDF conversion or PDF to PDF/A conversion?

I’m converting from docx to pdf/a, but the problem also occurs when converting from docx to pdf or from rtf to pdf/a. Any file edited with Microsoft Word and then converted in Aspose to PDF or PDF/A presents this anomaly on the font.

@L1b3r0 I tested conversion of your document to PDF using MS Word and Aspose.Words. The output looks correct to me. There is slight difference, but it does not affect the document layout:
MS Word: ms.pdf (59.9 KB)
Aspose.Words: out.pdf (32.1 KB)
Aspose.Words with text shaping enabled: out_HarfBuzz.pdf (32.1 KB)

I do not think that the problem is caused by font size change. If possible, please attach your problematic input and output documents where content is moved to the next page here for testing. We will check the documents and provide you more information.

Thanks for the reply, that slight difference doesn’t affect all documents, especially simple ones like the one I attached. In some documents with many pages of text, however, it can affect the page layout. Unfortunately, for privacy reasons, I cannot attach the original document on which I detected the problem. If my managers give me the OK to let you test it, I will attach it later. Thank you.

@L1b3r0 We will wait for your input and output documents. Unfortunately, without real problematic documents it is impossible to say what causes the problem.