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

Free Support Forum - aspose.com

How to assign default font for rendering PDF to JPEG


For certain PDF file fonts are not included nor included in system font. (em9.pdf)
Is there any way to assign a default font for rendering PDF by JpegDevice?

Please help!

Hi Nono,

I am afraid the requested feature is
currently not supported but for the sake of implementation, I have logged this
requirement in our issue tracking system under New Features list as PDFNEWJAVA-33727.
We will further investigate this requirement in details and will keep you
updated on the status of a correction. <o:p></o:p>

We apologize for your inconvenience.


Thanks for supporting, we would like to know is there any update regarding to case PDFNEWJAVA-33727?

Thank you!


Please kindly help on this issue.

Hi Sophia,

Thanks for your inquiry. I’m afraid we have recently noticed the issue and logged your requirement as a new feature in our issue tracking system. Its pending for investigation in the queue with other priority tasks, we will be in a good position to share an estimate with you as soon as our development team completes its investigation.

Thanks for your patience and cooperation.

Best Regards,

Hi Sophia,

Thanks for your patience. To accomplish your requiremtns you can font for all text fragments before rendering as following. Hopefully it will help you to accomplish your requirements.

//open document<o:p></o:p>

com.aspose.pdf.Document pdfDocument = new com.aspose.pdf.Document(myDir+"em9.pdf");

//setting default font part

com.aspose.pdf.TextFragmentAbsorber tfa = new com.aspose.pdf.TextFragmentAbsorber();


com.aspose.pdf.TextFragmentCollection tfc = tfa.getTextFragments();

for (com.aspose.pdf.TextFragment tf : (Iterable) tfc)


// create stream object to save the output image

java.io.OutputStream imageStream = new java.io.FileOutputStream(myDir+"Converted_Image.jpg");

//create JPEG device with specified attributes

//Quality [0-100], 100 is Maximum

//create Resolution object

com.aspose.pdf.devices.Resolution resolution = new com.aspose.pdf.devices.Resolution(300);

//create JpegDevice object where second argument indicates the quality of resultant image

com.aspose.pdf.devices.JpegDevice jpegDevice = new com.aspose.pdf.devices.JpegDevice(resolution, 100);

//convert a particular page and save the image to stream

jpegDevice.process(pdfDocument.getPages().get_Item(1), imageStream);

//close the stream


Please feel free to contact us for any further assistance.

Best Regards,

The issues you have found earlier (filed as PDFNEWJAVA-33727) have been fixed in Aspose.Pdf for Java 9.0.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.