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

Free Support Forum - aspose.com

Aspose-pdf-java (19.12) font issue

I am using licensed version of aspose pdf (19.12). Is there aspose pdf required all the fonts available in the system?

I have tried to extract a fonts from the source pdf file, and try to embedded in the replacing pdf, its not working.Its make an error: Font embedding is prohibited because of font license restrictions.
Lots pdf make an error like this “font is not avialble”
Is there any other option available to replace a raw text? We need to replace lakhs pdf files.

Implemented code:

// Initialize License Instance
com.aspose.pdf.License license = new com.aspose.pdf.License();
// Call setLicense method to set license
final FileInputStream fis = new FileInputStream(filePath);
Document pdfDocument = new Document(fis);
textFragmentAbsorber = new TextFragmentAbsorber(“Test”, new TextSearchOptions(true));

// Get the extracted text fragments into collection
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.getTextFragments();
// Get the extracted text fragments into collection
for (TextFragment textFragment : (Iterable) textFragmentCollection) {
Font font = textFragment.getTextState().getFont();
float font_size = textFragment.getTextState().getFontSize();
int font_weight = textFragment.getTextState().getFontStyle();
String fontName = font.getFontName();
//String required_font = (available_font_list.contains(fontName))? fontName : “”;
//if(required_font.trim() != “”) {
try {
}catch(Exception e) {
String error_msg = fontName +" :"+e.getMessage();
return baseObject.handleException(error_msg);
text_changes_done = true;



Thanks for contacting support.

Can you please share source file with us so that we may further investigate to help you out.