PDF save has an horrible result

I am testing right now Aspose.word 18.3 for Java and I have horrible result while saving a docx file as PDF
YOu can see attached screenshots ( word is blured ).Doc.jpg (32.4 KB)
Pdf.jpg (47.8 KB)
Red part is the “Evaluation Only” text.

Does someone have an idea why ?

My code is :
Document word;
try {
word = new Document(wordDocument.getPath());
} catch (Exception ex) {
throw new FusionException("Impossible d’ouvrir le fichier Word : " + wordDocument.getName());
}
try {
word.save(targetPdfDocument.getPath() + “.docx” );
PdfSaveOptions options = new PdfSaveOptions();
word.save(targetPdfDocument.getPath(), options);
} catch (Exception ex) {
throw new FusionException("Impossible de sauvegarer le fichier Word fusionné pour le fichier : " + wordDocument.getName());
}

@aimline,

Thanks for your inquiry. Please ZIP and attach your input Word document here for testing. We will investigate the issue on our side and provide you more information.

Hi,
Here is the code :
try {
word.save(targetPdfDocument.getPath() + “.doc” );
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_A);
word.save(targetPdfDocument.getPath(), options);
} catch (Exception ex) {
throw new FusionException("Impossible de sauvegarer le fichier Word fusionné pour le fichier : " + wordDocument.getName());
}
here are the files :Test.zip (19.4 KB)

@aimline,

You have shared the output documents. Please ZIP and attach your input Word document here for testing. Thanks for your cooperation.

Hi,

You find attached a Zip with 4 files : files.zip (47.1 KB)
What I do is open the model.docx then merge with file datasource.csv then save as merge.docx then try save as merge.pdf :
word = new Document(wordDocument.getPath());
word.getMailMerge().execute(…
word.save(targetPdfDocument.getPath() + “.docx” );
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_A);
word.save(targetPdfDocument.getPath(), options);

The merge seems OK, the save as docx too but not the save as pdf.

Thanks.

@aimline,

Thanks for sharing the detail. We have tested the scenario using latest version of Aspose.Words for Java 18.3 with following code example. We have not found the shared issue except the font substitution warnings. Please check the attached output PDF. 18.3.pdf (68.4 KB).

Please ZIP and attach the fonts used in your document e.g. “C39T30Lfz” and “Helvetica” for further testing. Please also share the operating system and Java version. Thanks for your cooperation.

Document doc = new Document(MyDir + "model.docx");

String[] field = new String[] {"Adresse", "Civilite", "CodePostal", "Fichier1", "Fichier2", "FichierRep", "montant", "Nom", "Prenom", "Ville", "REFERENCE_POSTEASY"};
String[] value = new String[] {"REFERENCE_POSTEASY batiment C 13 rue des Lapins Blancs", "m.", "75000", "4Pages.pdf", "5Pages.pdf", "pr1.pdf", "123", "DURAND", "Paul", "PARIS", "0332018075PLI000062"};

doc.getMailMerge().execute(field, value);

doc.setWarningCallback(new com.aspose.words.IWarningCallback() {
    @Override
    public void warning(com.aspose.words.WarningInfo warningInfo) {
        if(warningInfo.getWarningType() == WarningType.FONT_SUBSTITUTION)
            System.out.println(warningInfo.getDescription());
    }
});
PdfSaveOptions options = new PdfSaveOptions();
options.setCompliance(PdfCompliance.PDF_A_1_A);
doc.save(MyDir + "18.3.pdf", options);

Hi,

I don t know why but on my machine all is OK and on my server, it do not use a “good” font :
WORD : Font ‘C39T30Lfz’ has not been found. Using ‘esint10’ font instead. Reason: closest match according to font info from the document.]]

How can I make it use another font ?

Regards.

@aimline,

Thanks for your inquiry. Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats (JPEG, PNG, PDF or XPS). You need to install fonts that are used in your document on the machine where you’re converting documents to PDF. Please refer to the following article:

How Aspose.Words Uses True Type Fonts

I added required Font to the machine and all is OK now.
Thanks.

@aimline,

Thanks for your feedback. It is nice to hear from you that your problem has been solved. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.