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

Free Support Forum - aspose.com

FontRepository.setReplaceNotFoundFonts() replaces embedded fonts


is FontRepository.setReplaceNotFoundFonts() supposed to replace embedded fonts? Please find attached a PDF which is rendered as PNG with the following Java code snippet:

public static void main( String[] args ) throws Exception
	Document pdfDocument = new Document( "example-custom-font.pdf" );
	FontRepository.setReplaceNotFoundFonts( true );
	PngDevice device = new PngDevice( new Resolution( 100 ) );
	device.process( pdfDocument.getPages().get_Item( 1 ), new FileOutputStream( "generated.png" ) );

The generated and the expected PNGs are attached as well.


example-custom-font.pdf (37.2 KB)
expected.png (12.2 KB)
generated.png (12.4 KB)


Thank you for contacting support.

FontRepository performs font search, it searches in system installed fonts and standard PDF fonts so the fonts being used in your PDF document are treated as NotFoundFont thus replaced, which causes the difference between expected and generated image. However, we have logged an investigation ticket with ID PDFJAVA-38201 in our issue management system for further investigations. We will let you know as soon as some significant updates will be available in this regard.