Free Support Forum - aspose.com

Formatting errors converting to Aspose.PDF

I am attempting to convert a document that is supplied by an external company to pdf using aspose.words (v3.5.0.0) and aspose.pdf (v2.9.2.0) in an ASP.NET application.

If I stream the document back to the client as an msword document then this appears fine in the browser. However, once the document is converted to pdf there are some formatting issues.

1) There is an extra line from the table at the top of the first page that appears just above the borrowers section.

2) The Date: text below the Signatures is indented incorrectly.

3) The DATA PROTECTION section is indented incorrectly and the text appears below the image rather than inline.

4) In the terms and conditions on page 2, the text in the bullet list in section 4.4 is indented incorrectly when compared to the text in the bullet lists in sections 6.1, 6.2.1, etc.

Original word document template attached for comparison.

Thanks for reporting these issues to us. I have researched them and here is what I found:

1) There is an extra line from the table at the top of the first page that appears just above the borrowers section.

That can be fixed by setting the 'borrowers' cell borders as none, and restoring the left red border for 'account no' afterwards.

2) The Date: text below the Signatures is indented incorrectly.

The cause of a problem is that 'Signature' and 'Date' text are in one line now, separated by a number of spaces. I suggest putting explicit line break between them as a workaround.

3) The DATA PROTECTION section is indented incorrectly and the text appears below the image rather than inline.

That is caused by the 'lock' image that is handled incorrectly during the conversion. I have logged that issue and will discuss with Aspose.Pdf team shortly if it could be corrected fast enough. Meanwhile, I recommend removing it from the template document temporarily to avoid formatting problems.

4) In the terms and conditions on page 2, the text in the bullet list in section 4.4 is indented incorrectly when compared to the text in the bullet lists in sections 6.1, 6.2.1, etc.

The cause of a problem is that formatting of the list items in section 4 and 6 are actually different. And while they are looking the same in Word, they display differently in PDF. I suggest setting the same paragraph formatting for the list items to work around the problem.

I agree that in theory the document layout should be converted one-to-one preserving the document appearance regardless of actual formatting settings behind the scenes. But due to complexity and heavy differences between word and pdf layout format it is hard to achieve exact conformity in conversion tool. We are trying to solve these problems as they arise.

I have attached the corrected document. We will try to correct these issues as soon as possible and inform you here in this thread after they will be solved.

The problem with the extra border line occurs because you have horizontal and vertical borders (inner borders) for the whole table specified, two rows in the table only and two cells in the column are vertically merged. This creates a situation where Aspose.Words incorrectly uses the horizontal border of the table as a bottom border of the cell. I'm not going to fix this issue right now as it will occur pretty seldom in the output. You can easily workaround by selecting the table and removing all borders, then setting the borders you want explicitly. Just avoid setting the horizontal and vertical borders for the whole table.

The list indent issue is fixed in Aspose.Words 3.5.1 that will be released shortly.

We have released Aspose.Words 3.5.1.

  • List items having different paragraph formatting look identical in Word but different when converted to PDF.
  • http://www.aspose.com/Community/Blogs/roman.korchagin/default.aspx

    Wow, thank you very much for the quick response and quick fix. Do you have an ETA on the fix to the lock image problem as I am noticing this in documents sent to us by other companies (it is a legal requirement to have that image on the documents that I am processing)?

    I am also noticing various minor problems on other documents that I am attempting to process, is it best to create a separate thread for each new problem I encounter or to place them all in this thread?

    The issue with the image was transferred to Aspose.Pdf team. You can contact them directly via Aspose.Pdf forums.

    I think that one thread for your word to pdf conversion issues will be a good idea. Although it should be a new thread separate from this one.