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

Free Support Forum - aspose.com

Get Font Type and Encoding Type from PDF File

Hello Team,


Is it possible to get Font type and Encoding type from a PDF File.


Thanks in Advance
Priya Dharshini

Hello Priya,


Thanks for your inquiry.

Currently you can get Font Name from a PDF document and save it in an output stream object like in following code snippet.

Document
doc = new Document(dataDir + “input.pdf”);<o:p></o:p>

// Iterate through all the pages

for (com.aspose.pdf.Page page : (Iterable) doc.getPages()) {

if (page.getResources().getFonts() != null) {

for (com.aspose.pdf.Font pageFont : (Iterable) page.getResources().getFonts()) {

System.out.println(pageFont.getFontName());

ByteArrayOutputStream dstStream = new ByteArrayOutputStream();

pageFont.save(dstStream);

}

}

}



However, we have logged an enhancement ticket as PDFJAVA-36721 in our issue tracking system for requested feature. I have associated ticket ID with this thread, so that you will be notified once the feature is added in the API. Please be patient and spare us little time. We are sorry for the inconvenience.


Best Regards,

Hi Team,

Is there any new update?

Thanks & Regards,
priyanga G

@priyanga

Thanks for your inquiry.

We have implemented the method getType() in the class com.aspose.pdf.Font, but for getting font encoding, we need additional investigation. Our product team will further investigate the feasibility of the feature and as soon as we have some new on its availability, we will let you know. Please spare us little time.

We are sorry for the inconvenience.

Hi @asad.ali,

Thanks for your quick response.