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

Free Support Forum - aspose.com

Pdf to Image with missing font

Hi I’m working on a japanese pdf document with a font not embed.
I have not the font on my system but an ‘equivalent font’ (same code page ranges handled) : Meiryo.
I tried to convert the document to a png file. But I glyphs are not found.
Could you please help me to found a way to make it work?
We are considering bying a license for aspose pdf if this behavior is available.

My code :
public class AsposeRenderer {
public static void main(String[] args) throws Exception{
FontRepository.addLocalFontPath("/home/pierres/tmp/fontfolder");
boolean replaceNotFoundFonts = FontRepository.isReplaceNotFoundFonts();
FontRepository.setReplaceNotFoundFonts(true);
String filename = “/home/pierres/Downloads/payslip-20190920.pdf”;
Path path = Paths.get(filename);
Document doc = new Document(filename);
Page item = doc.getPages().get_Item(1);
FontCollection fonts = item.getResources().getFonts();
PngDevice renderer = new PngDevice();
BufferedImage bufferedImage = renderer.processToBufferedImage(item);
File output = new File(path.getParent().toFile(), String.format(“preview%s.png”,System.currentTimeMillis()));
ImageIO.write(bufferedImage,“png”, output);
System.out.println("Outputfile : "+output.getCanonicalPath());
}
}

@PierreS

Thank you for contacting support.

Would you please share the PDF document along with the font file as ZIP so that we may try to reproduce and investigate it in our environment.

I’m waiting for an anonymized file.

Pierre

@PierreS

Please note that forum attachments are accessible to topic owner and Aspose staff only. You can also share the data privately with us by clicking on my username and then message icon. Take all the time you need and get back to us as per your convenience.

Hi I am not allowed to share the document.
And I have not received the document. And probably will not.

@PierreS,

We regret to inform that without source file it is difficult for us to investigate the root cause of the problem. We have made this thread private, now only you and Aspose staff has access to this thread. Please share source file with us so that we may help you out.