Margins disappear when saving DOCX as PDF

Hi,

When we use Aspose.words to convert a DOCX to PDF, the margins are messed up. Actually, the left margin goes away. I have attached the input DOCX and the output PDF.

Is there a workaround for this? Thanks!

Here's some code. As you can see, I'm simply opening the file, renaming it and saving as PDF.

words.Document doc = new words.Document(Filename);
string uid = Guid.NewGuid().ToString();
FileInfo fi = new FileInfo(Filename);
string fname = fi.Name;
string ext = fi.Extension;
string outputname = uid + "." + fname.Replace(ext, ".PDF");

string paramExportFilePath = TempFileLocation + outputname;

doc.Save(paramExportFilePath, words.SaveFormat.Pdf);

Thanks for your help!

Hello, Aspose support,

Are there any thoughts on this? I am doing a demo this afternoon and the results could be the difference between a sale or no sale. The program manager has seen the margin issue and is concerned. If I can tell him that there is a fix, then he will probably be OK with using Aspose for our conversions.

Thanks in advance for a prompt response.

Rich

Hi Rich,


Thanks for your inquiry and sorry for the delayed response. While using the latest version of Aspose.Words i.e. 13.7.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of your issue is WORDSNET-8746. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

In addition, you can work around this issue by replacing textframes in your document with textboxes. Textframes is a legacy feature and not used very often in documents any more.

Best regards,

Hello,

Thank you for the reply. Could you please provide me with a code sample that will fix this margin issue?

Also, what is the timeframe when we can expect a fix?

Thanks!
Rich

Hi Rich,


Thanks for your request. Unfortunately, your issue is currently pending for analysis and is in the queue. Please note that, an issue first needs to be investigated to find the exact source of problem and then we investigate the best possible way to fix the issue. So, I can’t provide you any reliable estimate at the moment. Once the issue is analyzed, we will then be able to provide you more information. Sorry for the inconvenience.

Best regards,

Thank you for you reply.

Could I have some code to help with my margin issue? I am unfamiliar with TextFrames.

TIA!

Hi Rich,


Thanks for your request. Unfortunately, at this time, I can’t provide you a workaround code snippet because Aspose.Words doesn’t fully support Frames. However, you may easily modify your input Word document by using Microsoft Word application to make it compatible with Aspose.Words. I have also attached a modified version of your document here for your reference. On the first page, you can see two copies of text ‘SECTION I’ and ‘SECTION II’ each. The first copy of each text is contained inside a Frame while the copy underneath the first copy is contained inside a TextBox. When you convert this modified document to Pdf format by using Aspose.Words, the copy i.e. contained inside TextBox is rendered correctly. Similarly, you can manually replace all occurrences of Frames with TextBoxes. I hope, this helps. Please let me know if I can be of any further assistance.

Best regards,

Thanks, but that really won't work for us. We have to support documents as uploaded to us by our users.

To be honest, I'm a bit disappointed that this bug wasn't caught by your QA folks. In a test set of about 100 Word docs, I can repro this several times.

Also, I'm curious why you suggested TextFrames as a fix, but now you are saying you don't support Frames. Did I misunderstand something?

Hi Rich,


Thanks for your inquiry. First off, the problem occurs because Aspose.Words does not fully support positioning text frames in your Word document upon rendering and to work it around you may manually replace those text frames with text boxes. As this manual workaround is not acceptable for you, I am afraid, you’ll have to wait for the fix to WORDSNET-8746. Secondly, as WORDSNET-8746 is currently pending for analysis, please spare us some time for it’s investigation and resolution. Our development team will further look into the technical details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

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


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

Hi,

First of all - Thank you for this fix. The output docs are much better.

There is an issue that my customer found. Please look at the attached docs and notice that the footer on page 5 has some malformed text.

Is there a workaround or maybe there isa fix in the works?

Thanks!

Rich

Hi Rich,


Thanks for your inquiry. The Pdf document you attached (BBB(H)-A.pdf) was generated using Aspose.Words for .NET 13.8.0, I would suggest you please upgrade to the latest version (13.12.0) from the following link. I hope, this helps:
http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/default.aspx

Secondly, this Pdf document (BBB(H)-A.pdf) doesn’t correspond to the Word document (BBA(H)-A.docx) i.e. it has 14 pages while the Word document has only 3 pages. Could you please attach the correct input Word document here for testing? I will then investigate the issue on my side and provide you more information.

Best regards,

Thank you for your reply.

Per your suggestion, I am now using the most current version (13.12). There is no change.

Sorry about the incorrect file upload, I have uploaded the docx and the pdf again (and I’m pretty sure they match this time!) :slight_smile:

Thanks! Have a great day!

Hi Rich,


Thanks for reporting this issue to us. While using the latest version of Aspose.Words i.e. 13.12.0, I managed to reproduce this issue on my side. I have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-9526. Your thread has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-9526) have been fixed in this Aspose.Words for .NET 19.8 update and this Aspose.Words for Java 19.8 update.