We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Tables rendered / displayed incorrectly when MS Word docx file is converted to PDF using Aspose.Words .NET

Hi,


I am currently evaluating the Aspose Suite of products to find out whether they will serve our company’s purposes before purchasing the product.

I downloaded Aspose Total released 14-Aug-2013 (.Net version) and I am currently evaluating the Aspose Words module of the package (version Aspose.Words For .Net 13.7.0). I seem to have come across a problem with converting an MS Word docx file to PDF because the conversion is not rendering/converting the tables in the docx file correctly in the pdf

Here is the code that I use

String inputFile = “test_docx_file.docx”, outputFileName = “coverted_to_pdf.pdf”

var saveFormat = SaveFormat.Pdf;
doc.Save(outputFileName, saveFormat);


If you examine the results from the attachments I have attached, the “converted_to_pdf.pdf” file has all the tables collapsed. The tables should look like way they do in the “test_docx_file.docx”. This works fine if I use the MS Save AS PDF plugin but that is not feasible for server deployments. I am using MS Word 2010 and MS 2013 to produce the docx files and .Net 4.

Please let me know if you require anymore info

Can you please help me to fix this problem??

Kind regards

Hi,


I was wondering whether anyone had seen this problem and whether they have any solution to this. I dont mean to be pushy but its a little urgent and I need to know whether this is known problem and whether it can be solved otherwise, I will not be able to recommend this product.

Thanks

Hi George,


Please accept my apologies for late response.

Thanks for your inquiry. I have tested the scenario and have not found the shared issue while using latest version of Aspose.Words for .NET 13.7.0. I have attached the output Pdf file with this post for your kind reference.

I have tested the scenario at Windows 7 (64 bit) and .NET Framework 2.0 and 4.0. It would be great if you please share following details for investigation purposes. Please make sure that you have shared the same document for which you are facing the issue.

What environment are you running on?
  • OS (Windows Version or Linux Version)
  • Architecture (32 / 64 bit)
  • .NET Framework version


Thanks Tahir


My environment is Follows

Win7 64 bit
.Net Version 4
Aspose.Words for .NET 13.7.0. zip only version

The Aspose.Words DLL that I reference from the our app is the one found in the .net 2.0 folder of the unzipped aspose folder. Is that the right DLL?

There are a few things that I have noticed. The application that we are building is a An ASP.NET MVC 4 and WebForms mix application. I have noticed that if try converting the docx file to PDF in the ASP.NET environment, I get the results that I have reported however, if I create a console application can do the conversion in the console application environment, it works fine. Do you think that it might have something to do with the ASP.NET context?? If so, how do I fix it?

Kind regards

George

Hi George,


Thanks for sharing the detail. You are using the correct DLL. You can Use Aspose.Words for .NET to build ASP.NET, Web Services, WinForms or any other type of application for any .NET Framework version.

Regarding your issue, I have tested the scenario at same environment with an ASP.NET application and have not found the shared issue. It would be great if you please create separate web application and test this issue. If the problem still remains, please share your test web application here for testing? Are you using Visual Studio Development Server or Local IIS Web server? Please share this detail and I will investigate the issue on my side and provide you more information.

Hi Tahir


Thanks for your reply and the help that you have been giving me.

I have finally narrowed down the problem. Its not down to environment but rather something how Aspose.Words is handling the word file

I have attached a new Ms Word DOCX File (test.docx) that illustrates the problem. If you just download the MS Word DOCX (test.docx) file and run the conversion code on it without editing the ms word file, you will find that all the tables have been collapsed as is in my attached pdf file (test-pdf-collapsed,pdf). However, If you open the MS Word file (test.docx) and the then edit it (e.g. add a space anywhere in the file) and then save it in MS Word and then run the conversion code on it. Everything comes out OK (see test-ok.pdf).

We are using OpenXML to generate the word file just for your information.

So what can be the problem?

As your are aware, it will be unacceptable for us to open ms word on a server, edit the word file and then run the conversion.

The full code that I am using for the conversion is

class Program
{
static void Main(string[] args)
{
String strWordFile = “”, strPDFFile="";

if (args == null || args.Length < 2)
throw new ArgumentException(“Invalid arguements provided. Have you provided the name of the MS Word File to be converted and the name of the PDF file”);

// Get the name of the ms word file to be converted
if (args[0] != null || !"".Equals(args[0]))
strWordFile = args[0] as String;

// Get the name of converted PDF file
if (args[1] != null || !"".Equals(args[1]))
strPDFFile = args[1] as String;

if (!File.Exists(strWordFile))
throw new ArgumentException(“The MS Word file’” + strWordFile + "’ provided does not exist. ");

//Convert the file to PDF
Document doc = new Document(strWordFile);
doc.Save(strPDFFile, SaveFormat.Pdf);
}
}

Hope to hear from you soon and thanks for your time

Kind regards

Hi George,


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

Thanks for looking into this for us.

Do you know long these things usually take to get resolved and released??
For us, its really critical for those tables to render correctly when the MS Word doc is converted to PDF. Hence, if its going to take months to resolve, it will be a show stopper for us.

Please let me know

Kind regards

Hi George,


Thanks for your inquiry. I would like to share with you that issues are addressed and resolved based on first come first serve basis. Currently, your issue is pending for analysis and is in the queue. I am afraid, I cannot provide you any reliable estimate at the moment. Once your issue is analyzed, we will then be able to provide you an estimate.

Thank you for your patience and understanding.

Hi Tahir


Thanks for your reply and looking for looking into this. Unfortunately, we will have to consider other options as we cannot plan our app release if we cannot tell when a fix is going to applied for this issue, which is quite fundamental to our app. Its a shame because we really liked the product. Thanks for your help in any case

Kind regards

Hi George,


Thanks for your inquiry. I have requested the development team to share the ETA of this issue. 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.