How to set defaultTextState for the entire document

Hi,

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”));
textState.setFontStyle(FontStyles.Bold);
textState.setLineSpacing(30f);
doc.getPageInfo().setDefaultTextState(textState);

TextFragment fgmt = new TextFragment(“test”);

fgmt is not using defaultTextState.

Thanks
Mamatha

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