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

Free Support Forum - aspose.com

PdfConverter outputting blank page when saving certain PDF

I have attached a sample pdf file. Using the below code, the output tiff is a completely blank page. I have also tried using aspose.pdf.Document and process() on a TiffDevice and a PngDevice and both output blank pages.


I’m hoping you can share with me what is special about this PDF and what if any settings I can use with aspose to convert this PDF to an image. Thanks!


PdfConverter converter = new PdfConverter();
converter.setResolution(new Resolution(300));
converter.bindPdf(new FileInputStream(“sample.pdf”));
converter.doConvert();
converter.saveAsTIFF(new FileOutputStream(“some/path”));

Hi Adam,


Thanks for your inquiry. I have tested the scenario with Aspose.Pdf for Java 11.2.0 and unable to notice any issue. Please download latest version of Aspose.Pdf for Java, it will resolve the issue. However if the issue persist then please share your some more details about the issue, so we will investigation it further.

We are sorry for the inconvenience caused.

Best Regards,

Is 11.2.0 in your maven repo? I’m only seeing 11.0.0. My project uses maven dependencies.


edit: Nevermind I do not see the issue using 11.2.0 either. Thanks!!!

Hi Adam,


Thanks for your feedback. It is good to know that your issue has been resolved.

Please keep using Aspose.Pdf and feel free to contact us for any further assistance, we will be more than happy to extend our support.

Best Regards,

I’d like to reopen this issue. I cannot reproduce the problem using Aspose.Pdf 11.2.0 or 11.3.0 when running locally on Mac OS so I thought the problem was solved.


However we are still experiencing this problem when running on our servers (Amazon Linux AMI 2015.09 with Oracle java 1.8.0_73). At first I suspected that we were just not picking up on the new version of the software but I have triple checked the class path and inspected the MD5 sums of the Aspose jar files and they match the new version.

Do you have any advice?

Thanks,
Adam

Hi Adam,


Thanks for your inquiry. We are looking into it and will update you soon.

Best Regards,

Hi,


Have you been able to reproduce the issue at all? I have another example of a file that converts poorly on our server but looks great when run locally on my Mac. I’ve attached the before (tax.pdf) and the after (tax.tiff.zip).

-Adam

Hi Adam,


We are sorry for the inconvenience. Apparently it seems its true type fonts related issues. Aspose.Pdf for Java Jar is not finding proper fonts on your Linux server… I have tested the PDF to TIFF conversion with your shared PDF document on Linux(CentOs) and unable to notice the issue. I have installed Microsoft fonts on my CentOS VM and these fonts are installed in system default font path i.e. /usr/share/fonts/msttcorefonts/.

Please note most of the PDF documents that we convert are created by people using Windows or Mac OS operating systems with fonts that are installed with Microsoft Windows or with Microsoft Office. So it is recommended to either install Microsoft fonts (mscorefonts) or copy true type fonts from your windows/Mac machine to your Linux server system default font folder path and try the conversion. Hopefully it will resolve the issue.

Furthermore if you want to use fonts form some of your custom folder then you need to add that folder path into LocalFontPath as following. You can use following methods to get system folder of fonts or set font path to font folders.

  • Document.getLocalFontPath () - shows the system folder in which project will look for fonts.
  • Document.setLocalFontPath (String) - Setting font path to custom folder

// Set font folder path<o:p></o:p>

String path = "/home/tilal/fonts/";

// Adding a single font directory

// com.aspose.pdf.Document.addLocalFontPath(path);

// setting the user list for standard font directories

java.util.List list = com.aspose.pdf.Document.getLocalFontPaths();

list.add(path);

com.aspose.pdf.Document.setLocalFontPaths(list);

....

....


Best Regards,

I’m still having some trouble with this – what should the contents of my /usr/share/fonts folder look like? Does aspose recurse that directory if .ttf files are placed in sub-directories? Or would I need an explicit call to Document.addLocalFontPath() ?


Is there logging that can be enabled to inspect what fonts Aspose PDF is able to read?

Ok it turns out that the font file resources were getting modified and corrupted during the build, so some of the font files weren’t readable by Aspose. I fixed that and was able to get good results.


It would still be nice to have some kind of logging to help diagnose these kinds of problems.

Thanks!
Adam

Hi Adam,


Thanks for your feedback. It is good to know that you have managed to resolve the issue.

Furthermore for font logging, we have logged an investigation ticket PDFNEWJAVA-35650 in our issue tracking system for further investigation and rectification. We will keep you updated about the issue resolution progress.

We are sorry for the inconvenience.

Best Regards,