Hi Aspose
I have a issue regarding the quality of png-images inserted in my documents through DocumentBuilder.insertImage().
We have images that we want to insert in a word template using mail-merge.
Since the images represent graphs, we specifically use png (PNG24) to remain lossless. For safety sake, I now remove the alpha channel before insertion to make sure that this wasn’t the problem.
When we generate a pdf from the resulting word document (se code below), the resulting PDF shows the images with very visible compression artifacts instead of the crisp lossless version.
I have included 2 zoomed snippets from my picture - one from the original png, and one from the generated pdf.
Do you know if this is Aspose that saves the images in a sub-optimal form? And is there anything I could do to improve the quality of the images?
While investigating the issue last week, I temporarily tried saving the document to HTML instead, and noticed that this specific image was included in both png and jpg version in the resulting files. It seems to me, that maybe Aspose chooses to insert the jpg version in the resulting pdf as well?
I hope you can help me along…
Regards Jan
public File generatePDF(Document doc) throws Exception
{
File tmpFile = File.createTempFile("tmp", ".pdf");
PdfOptions options = new PdfOptions();
options.setJpegQuality(1);
options.setHeadingsOutlineLevels(0);
options.setExpandedOutlineLevels(0);
options.setTrueTypeFontsFolder(getClass().getResource("/Fonts").getFile());
doc.saveToPdf(0, doc.getPageCount(), tmpFile.getAbsolutePath(), options);
return tmpFile;
}