Image created by using Aspose Libraries on Unix is completely blank while on Windows is working fine

Hi Team,

We are using Aspose Licensed Libraries to read a pdf file which is not created by using Aspose libraries, while creating the Thumbnail image of the first page of this pdf file on Windows environment, we are able to get the image properly, but on Unix environment the same piece of code is giving us a completely blank image.

Thanks,
Naveen

Hi Naveen,


Thanks for your inquriy. I have tested the scenario over Linux(CentOs) using following code with Aspose.Pdf for Java 11.3.0 and unable to notice the issue. Please share your sample code here, we will look into it and will guide you accordingly.

PdfConverter converter = new PdfConverter();<o:p></o:p>

converter.bindPdf("samplePDFFIle.pdf");

String prefix = "thumbnail";

String suffix = ".jpg";

int imgCount = 1;

converter.setStartPage(1);

converter.setEndPage(1);

while (converter.hasNextImage())

{

converter.getNextImage(prefix + suffix, com.aspose.pdf.ImageType.getJpeg(), 100, 100, 100);

}


We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

Thanks for providing help here. However, I am facing this issue on Unix environment not on Linux, though I have changed my code as you have mentioned and will test the same on Unix. I provide you my feedback as soon as I face the issue again.


Thanks,
Naveen

Hi Naveen,


In addition to above reply. Please note on non-Windows OSs Aspose.Pdf for Java looks fonts in system default font path. For Example in case of CentOS it looks fonts in /usr/share/fonts/. I had installed Microsoft fonts on the CentOS and these fonts are installed in system default font path i.e. /usr/share/fonts/msttcorefonts/.

It seems Aspose.Pdf for Java is unable to find fonts on your system. Can you please install Microsoft fonts on your system or copy fonts from your windows OS and paste to your system default font path, and try the conversion again? Hopefully it will resolve the issue.

Furthermore if you want to use fonts form some 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);

....

....


We are sorry for the inconvenience caused.

Best Regards,