PDF output incorrect for List with "numbering style" and "character/font position" formatting properties

Hi Team,

PDF output is incorrect for List with “numbering style” and “character/font position” formatting properties.

This issue is seen in Aspose.Words for Java 13.4 for PDF output. The word output is fine.
Even the PDF output is good with version 11.3 and hence a regression in the latest version.
Please see attachments and sample code below.

private static void testListNumbering(DocumentBuilder docBuilder, Document doc)
{
    docBuilder.getListFormat().applyNumberDefault();
    docBuilder.getListFormat().getListLevel().setNumberStyle(1);
    docBuilder.write("Numbering character position blank");

    // 2nd
    docBuilder.writeln();
    docBuilder.getParagraphFormat().clearFormatting();
    docBuilder.getListFormat().applyNumberDefault();
    docBuilder.getListFormat().getListLevel().setNumberStyle(1);
    docBuilder.getListFormat().getListLevel().getFont().setPosition(10 * 20);
    // docBuilder.pushFont();
    docBuilder.write("Numbering character position 20");
}

Thanks,
Kumar

Hi Kumar,

Thanks for your inquiry. Please note that every new release of Aspose.Words comes up with some new features, enhancements in the existing features and bug fixes. The issue you have reported is not a bug.

The Font.setPosition sets the position of text (in points) relative to the base line. A positive number raises the text, and a negative number lowers it. Please see the code example of Font.setPosition from here:

https://reference.aspose.com/words/java/com.aspose.words/Font

Perhaps you want to set the first line or hanging indent. If this is the case, please use ParagraphFormat.setFirstLineIndent. This method sets the value (in points) for a first line or hanging indent. Use a positive value to set a first-line indent, and use a negative value to set a hanging indent. Please see the following code snippet for your kind reference and let us know if you have any more queries. Hope this helps you.

Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
Paragraph para = docBuilder.getCurrentParagraph();
para.getParagraphFormat().setFirstLineIndent(10.0);
para.getParagraphFormat().setFirstLineIndent(-10.0);
docBuilder.getListFormat().applyNumberDefault();
docBuilder.getListFormat().getListLevel().setNumberStyle(1);
docBuilder.write("Numbering character position blank");
docBuilder.insertBreak(BreakType.LINE_BREAK);
docBuilder.write("Numbering character position 20");
doc.save(MyDir + "out.docx");
doc.save(MyDir + "out.pdf");

Hi Tahir,

I don’t understand why Word output is good and PDF output is wrong and still you say it’s not a defect. Please take a look at the attached documents (doc and pdf) in my first post, which were generated using Aspose.Words for Java 13.4.

Thanks,
Kumar

Hi Kumar,

Please accept my apologies for your inconvenience.

The Font.setPosition method sets the position of text (in points) relative to the base line. A positive number raises the text, and a negative number lowers it.

The Font.setPosition does not work correctly. I have logged this issue as WORDSNET-8235 in our issue tracking system. I have linked this forum thread to the same issue and you will be notified via this forum thread once this issue is resolved. We apologize for your inconvenience.

Hi Tahir,

Since this is a regression, could this be fixed asap? Otherwise, the existing document generation will fail for our customers after we upgrade to the current latest version. Our release date is getting closer.

Thanks,
Kumar

Hi Kumar,

Thanks for your patience.

This issue is not a regression issue. The Font.setPosition does not work correctly for list items with old version which you have mentioned. Please note that the Font.setPosition method sets the position of text (in points) relative to the base line. A positive number raises the text, and a negative number lowers it. Please execute the following code snippet to see the difference between positive and negative number value with Font.setPosition method.

Document doc = new Document();
DocumentBuilder docBuilder = new DocumentBuilder(doc);
docBuilder.write("Simple Text before setting Font.Position");
docBuilder.writeln("");
docBuilder.getFont().setPosition(0);
docBuilder.write("Start Text");
docBuilder.getFont().setPosition(-20);
docBuilder.write("-20 Some text");
docBuilder.getFont().setPosition(20);
docBuilder.write("+20 Some text");
docBuilder.getFont().setPosition(0);
docBuilder.write("End Text");
doc.save(MyDir + "Out.pdf");
doc.save(MyDir + "Out.docx");

Regarding issue WORDSNET-8235, I am afraid your issue has now been postponed till a later date due to some other important issues and new features. We will inform you as soon as there are any further developments.

We apologize for your inconvenience.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan