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

Free Support Forum - aspose.com

How to set defaultTextState for the entire document


I tried setting default text state for the entire document but it is not working.
TextState textState = new TextState();
textState.setFont(FontRepository.findFont(“Palatino Linotype”));

TextFragment fgmt = new TextFragment(“test”);

fgmt is not using defaultTextState.


Hi Mamatha,

Thanks for contacting support.

In order to set default TextState for whole PDF file, you need to iterate through all the TextFragments inside PDF file and update information for individual TextFragment. You may consider visiting following link for information on

In case you only need to replace font information for whole PDF file, please follow the instructions specified over Replace fonts in existing PDF file