Docx to PDf conversion text position using .NET

Hi

One of the selling points of ASPOSE for us was the fact that you could use the same code to produce WORD or PDF output. We’ve build our entire reporting engine around ASPOSE.

However, we’ve noticed a couple of weird anomalies with the PDF output. (Please see attached)

  • The ASPOSE to WORD document generated correctly.

  • Saving the WORD document to PDF created a very accurate representation of the Word document, apart from the images which is now pixelated.

  • The problem is the ASPOSE to PDF:

  1. Notice on p3, the image of the pie chart is simply cut off at the bottom of the page. The whole Asset Category Allocation section should’ve jumped to the next page, as is the case with Word.

  2. The way column widths are rendered is not uniform. Most of the time, this is not a problem, but compare the Benchmark calculation section on page 6: Instead of spreading out the columns to fit the content, as it does in WORD, it breaks the content to a second line to fit the column width. This is problematic for the dates, the amounts, and the index values, as well as the index heading. The system is extremely dynamic, and it is not possible to always correctly predict how much space is necessary for the content to fit in the columns, so we really need the columns widths to behave more flexible like it does in WORD.

Since these reports was generated by the report generator which wraps the ASPOSE assemblies, it will be very difficult to give you an accurate code sample of how this was generated. Therefore, I propose, if you could provide code samples of how to achieve the desired behavior and have closer similarity between the WORD and PDF output, that would much appreciated.

Hi Hanno,

Thanks for your query. I have managed to reproduce the both issues at my end by using shared Docx file as input. It would be great if you please share your input document and code which generates the table ( Benchmark calculation ).

I have logged these issues in our issue tracking system. You will be notified via this forum thread once these issues are resolved. You can overcome the second issue by calling UpdateTableLayout() method before saving the PDF document.

Document doc = new Document(MyDir + "ASPOSE+to+WORD.docx");
doc.UpdateTableLayout();
doc.Save(MyDir + "AsposeOut.pdf");

We apologize for your inconvenience.

Hi

Thanks for the quick reply.

Though the _document.UpdateTableLayout(); did prevent the content from breaking at inappropriate places, other tables are now even more out of sinc with the Word version, breaking in up to 4 lines, where the Word version only break into 2 lines.

I’ll see if there is a way I can script the source code, so you can investigate.

Hi Hanno,

Thanks for sharing the information. We will update you via this forum thread once your both issues are resolved.

Hi.

I’ve littered the code of my reporting engine with a stringbuilder, recording - as far as possible - every ASPOSE method call.

I’ve focused on those methods related to building tables, there are quite a number of other methods which I did not record. However, this produced non-OO linear code, littered with lots of repetitive code (which is mostly formatting) and te file size is already 2MB. In order to help your developers to see what’s going on, I’ve added my method names as comments, and indented the code.

I don’t know if this would be of any help to your developers, but since I’ve gone through the effort, I thought I’ might as well send it to you - to use or not to use.

Also, I’ve attached the output document of the generated code. As you can see, it is a very poor copy of the original, but I think there are enough tables which did render correctly, and which might be of some use to your developers.

If you wish, I could spend more time trying to get the code output to be more accurate. Let me know.

Hi Hanno,

Thanks for your help. We always appreciate positive feedback from our customers. We will update you via this forum thread once these issues are resolved.

We appreciate your patience.

Hi

I’ve received another issue with the ASPOSE pdf document. As already mentioned,
System A (using Aspose) generate the fund fact sheets and dump them in a database.
System B generates a report (Also using Aspose) and then retrieve these fund fact sheets from the database and attach them to the Report.

(See word document, scroll down to where the page heading says “SA Cash - CAM Fortis”)

When the report is generated in WORD, the attached fund fact sheets renders correctly, and it also renders correctly when we save it as a PDF file from WORD.

However, notice the anomaly when it’s generated directly from ASPOSE:

  1. The “Fund Facts” heading on the top right hand side of the page moved down to line up with “Risk Profile” instead of “Fund Focus” from the Left hand side.

  2. The content below “Fund Facts” heading is removed and dump right in the middle of the “Fund Commentary” section near the bottom of the page.

Any help as to how to prevent this from happening will be greatly appreciated.

Thanks

Hi Hanno,

Thanks for your query. I have managed to reproduce the same issue at my side. I have logged this issue as WORDSNET-6711 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

I’ve been revisiting this issue, and though a lot more testing needs to be done, It seems like the issues raised in this post have been resolved already, as I’m struggling to recreate them.

I’ll let you know if I have anything new to report.

Regards

Hi Hanno,
Thanks for your feedback. Unfortunatly, the issues reported in this thread have not resolved yet. I have converted the shared document ( ASPOSE to WORD.docx, Quaterly Report.doc ) to PDF by using following code snippet and have found the same issue.

Document doc = new Document(MyDir + "in.docx");
doc.Save(MyDir + "out.pdf");

We will update you via this forum thread once these issues are resolved. Following is the isssues detail.
WORDSNET-6711

  1. The “Fund Facts” heading on the top right hand side of the page moved down to line up with “Risk Profile” instead of “Fund Focus” from the Left hand side.
  2. The content below “Fund Facts” heading is removed and dump right in the middle of the “Fund Commentary” section near the bottom of the page.

WORDSNET-6463 : The Pie chart at page 7 in Docx is cut off in PDF file
WORDSNET-6464 : The contents do not fit in table’s cell in output PDF file. The table with heading “Benchmark calculation”

Hi

I’ve generated a few more reports, and can confirm that at least 6464 is still a problem. Do you have any idea when these issues will be addressed, as they’ve been reported 6 months ago already. We want to take the report generator to the next level, where reports are automatically generated and send to clients without any human intervention, so the pressure is really mounting on me to find a reliable PDF solution. I would hope that that solution would be an ASPOSE solution - as that would be the least amount of effort. However, if these issues are not resolved soon, we might be forced to look at other options, which is not ideal. Is there any way you could up the priority on these issues?

Hi Hanno,

Thanks for your patience.

I am afraid your issues has now been postponed till a later date due to some other important issues and new features. However, I have requested the development team to share the ETA. As soon as any information is shared by them, I will be more than happy to share that with you.

We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-6711) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

The issues you have found earlier (filed as WORDSNET-6464) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.

@Hannodb,
The issues you have found earlier (filed as WORDSNET-6463) have been fixed in this Aspose.Words for .NET 18.2 update and this Aspose.Words for Java 18.2 update.
Please also check the following articles: