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

Free Support Forum - aspose.com

Set Characters per horizontal and vertical inch


I wanted to check if in aspose there is a way to set characters per horizontal inch and lines per vertical inch.


HI Rajeev,

Thanks for your inquiry. I am afraid the requested feature is not supported, so we have logged a new feature request PDFNEWNET-39037 in our issue tracking system for same. We will notify you as soon as it is implemented.

We are sorry for the inconvenience caused.

Best Regards,

Hi Tilal,

After ging through the spose api I came across methods setCharacterSpacing and setLineSpacing of TextFragment object, can you please guide me what is the purpose of these methods . It also has getCharacterSpacing, getLineSpacing and getWordSpacing, does any of these methods provides results related to spacing.


HI Rajeev,

  • The setCharacterSpacing(…) method is used to set the value of spacing between characters inside TextFragment.
  • The setLineSpacing(…) method is used to set the value of spacing between lines within TextFragment instance.

However I have observed that when using setCharacterSpacing(…) method, the text inside particular line is not being properly wrapped. It appears that line width is not being calculated according to character spacing value and some contents are being truncated. For the sake of correction, I have logged this problem
as PDFNEWJAVA-35025 in our issue tracking system. We will further
look into the details of this problem and will keep you updated on the status
of correction. Please be patient and spare us little time. We are sorry for
this inconvenience.


com.aspose.pdf.Document pdfDocument = new


com.aspose.pdf.TextFragment textFragment = new com.aspose.pdf.TextFragment("Sample TextFragment over multiple lines to check Line Spacing behavior and this is very large line of text to check the line spacing behavior");

// set spacing for characters inside TextFragment


// set spacing for lines of TextFragment instance


// add text fragment to paragraphs collection of first page of PDF file


// save PDF document


The issues you have found earlier (filed as PDFNEWJAVA-35025) have been fixed in Aspose.Pdf for Java 10.9.0.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.