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

Free Support Forum - aspose.com

Problem with font in PDF exported from DOCX

Hello,

After saving a docx document as pdf, in the resulting PDF the font is displayed incorrectly, even though I set a directory with fonts. Below you can find the code used:

package com.test;

import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.Paths;

import com.aspose.words.FontSettings;
import com.aspose.words.License;

public class AsposeDocxToPdfConversion
{      
    public static void main(String[] args) throws Exception
    {
        try(InputStream inputWord = Files.newInputStream(Paths.get("C:/test/test.docx"));
            OutputStream outputPdf = Files.newOutputStream(Paths.get("C:/test/test.pdf")))
        {
            FontSettings.getDefaultInstance().setFontsFolder("C:/test/fonts", false);
            
            com.aspose.words.Document asposeDoc = new com.aspose.words.Document(inputWord);
            
            asposeDoc.save(outputPdf, com.aspose.words.SaveFormat.PDF);
        }
    }
}

I also attach the source docx file (test.docx), the pdf file created by Aspose (test.pdf incorrect), the pdf file created by Word2016 (test-word.pdf correct), zip file with fonts from C:/test/fonts directory.

Is it a bug in the Aspose.Words for Java (I have checked also the newest version) or something in the code should be done differently?test.zip (631.3 KB)

@wjeczalik,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-15720. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.

@wjeczalik,

The issues you have found earlier (filed as WORDSNET-15720) have been fixed in this Aspose.Words for .NET 17.11 update and this Aspose.Words for Java 17.11 update.

Please also check the following articles: