Hi Alexey,
Attached is the same report exported into Word and PDF (the document is built using Aspose). On page 56 there’s an ident in PDF, which is not in Word (and it shouldn’t be there, in fact). Could you please advise what can possibly cause it? Regards,
Alex
Master report-Annual Report-30062019-Master report 1 (1).pdf (1.1 MB)
Master report-Annual Report-30062019-Master report 1 (10).docx (1.3 MB)
@AlexanderNovickov The problem is not reproducible on my side using the latest 26.3 version of Aspose.Words and simple DOCX to PDF conversion:
Document doc = new Document(@"C:\Temp\in.docx");
doc.Save(@"C:\Temp\out_af.pdf");
Here is the output produced on my side: out.pdf (1.1 MB)
As I can see you are using the old 24.11.1 version. Please try using the latest version of Aspose.Words and let us know if the problem still persists.
Hi Alexey,
Thank you for your reply. If you look closely into your document you will notice, that idents on pages 56, 57, 58 are different from the one on the page 55. I am adding the screenshots, probably it will explain better what I mean.
Regards,
Alex
PDF:
Word:
@AlexanderNovickov
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): WORDSNET-29153
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
Hi Alexey,
Sorry for returning to this one, but it looks like that indent can be a show stopper for our client, so I am trying to find a workaround for this issue. My initial thought was that PDF render didn’t cope with the table in the header, so I replaced it with a paragraph, but I am still having the same issue even though I tired to reset its left indent to 0 (see the files attached). Could you please suggest what else can I try to eliminate that gap? And one more question, I totally understand that currently the free support issues are low priority for your team, but is there any rough estimates for this one? Weeks, months, years?
Thank you once again,
Alex
Alex test-Notes to the financial statements-Alex test-Test header-Suffixes.pdf (134.3 KB)
Alex test-Notes to the financial statements-Alex test-Test header-Suffixes.docx (63.7 KB)
@AlexanderNovickov The problem is not reproducible on my side with the attached documents. Here is PDF produced on my side using Aspose.Words: out.pdf (132.8 KB)
And MS Word: ms.pdf (221.3 KB)
Also, we have completed initial analysis of the issue. The issue occurs because handling of an inline carriage return element in Aspose.Words layout does not match the current MS Word behavior. It appears that MS Word behavior has been changed at some point. There is a couple of paragraphs with w:cr (carriage return) inline element in the middle. In MS Word layout, w:cr is rendered as a paragraph break in both paragraphs. Aspose.Words handles the case when w:cr is in the last table cell paragraph specially, replacing it with a space.
Hi Alexey,
Thank you for your email. It seems if the file is saved to docx, read from docx and then saved to pdf the issue is not reproducible. If the document is saved from Aspose tree then you can observe it. Also I removed all the carriage returns from the header and still can observe the issue. Please find attached my project demonstrating the problem on the latest Aspose words (check out Note (continued) on the second page Word vs PDF.
Regards,
Alex
Comments.zip (63.3 KB)
@AlexanderNovickov Thank you for additional information. In your code you are explicitly adding line feed into the text by using StringBuilder.AppendLine method. Please see the following code that causes the problem:
Paragraph noteNameContPara = new Paragraph(doc);
primHeader.AppendChild(noteNameContPara);
StringBuilder sb = new StringBuilder();
sb.AppendLine(); // <----- This causes the problem.
sb.Append($"Notes (continued)");
Run nameContRun = new Run(doc, sb.ToString());
noteNameContPara.Runs.Add(nameContRun);
You can resolve the problem by using soft line break instead of line feed:
StringBuilder sb = new StringBuilder();
sb.Append(ControlChar.LineBreak);
sb.Append($"Notes (continued)");
Or if paragraph break is required, then add the text into a separate paragraph:
// Add empty paragraph
primHeader.AppendChild(new Paragraph(doc));
Paragraph noteNameContPara = new Paragraph(doc);
primHeader.AppendChild(noteNameContPara);
StringBuilder sb = new StringBuilder();
sb.Append($"Notes (continued)");
Run nameContRun = new Run(doc, sb.ToString());
noteNameContPara.Runs.Add(nameContRun);
In both cases the problem disappears.
Thank you Alexey, ControlChar seems to work.
1 Like