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

Free Support Forum - aspose.com

Conversion from Word Docuiment to PDF using Memory Stream - Freezes when saving the PDF

My code was working fine with previous versions of Aspose [ Word (3.6.1.0) , PDF (3.2.0.0), PDF.Kit (3.1.0.0)], but freezing with latest versions of Aspose [Word (9.1.0.0) , PDF (4.3.0.0), PDF.Kit (4.3.0.0)].

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

I have attached a simple test application build in Visual studio 2008 with two documents, its freezing on “RBL 581 EW Regulated Agreement.dot” document and working fine on the other.

Thanks in advance for your any help.

Any help on this please.

Hello Imran,

Thanks for using our products.

I am afraid I am unable to test the scenario because, the source word documents are password protected. Can you please share the password information so that we can try converting the documents at our end. We apologize for your inconvenience.

FYI, In recent versions of Aspose.Words for .NET a new method of saving Word file directly into PDF format has been introduced. For more related information, please visit How-to: Convert a Document to PDF

[VB.NET]

Dim document1 As Document = New Document("newword.doc", LoadFormat.Doc, templatePassword)
document1.SaveToPdf("d:/pdftest/WordtoPdfConversiontest.pdf")

Pwd is "BlemainGroupDoc".

Hello Imran,

Thanks for sharing the information.

I have tested the scenario using Aspose.Pdf for .NET 4.3.0 and Aspose.Words 9.1.0 using the code snippet that you have shared and I am unable to notice any problem. The PDF documents are properly being generated with the Legacy as well as Direct-to-PDF save method of Aspose.Words. The resultant PDF's that I have generated are in attachment, please take a look.

I would recommend you to please try using the Direct-to-PDF save method as I am afraid we might not be able to correct any issues reported under Legacy/obsolete method.

In case you still face any problem or you have any further query, please feel free to contact.

We apologize for your inconvenience.

Hi Nayyar,

Thanks for your help, so you mean the test application I sent you, is not freezing on “RBL 581 EW Regulated Agreement.dot” document, can you please sent me legacy code sample you used to generate this document.

I have tried the following second option as well it works

Dim document1 As Document = New Document("newword.doc", LoadFormat.Doc, templatePassword)
document1.SaveToPdf(
"d:/pdftest/WordtoPdfConversiontest.pdf")

BUT I also want to set following PDF properties

pdf.Title = title<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

pdf.OpenType = Aspose.Pdf.OpenType.Auto

pdf.IsTruetypeFontMapCached = True

pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath()

pdf.Save(pdfStream) ’Freezing Again

if I save pdf, so its again freezing for above doc.

Hello Imran,

I have used the same code snippet that you have shared to convert the word document into PDF format.

As you have mentioned, the Direct-to-PDF save method is working correctly for you, then I would suggest you to please try using this approach. With the legacy method, you are using the following code lines and they are used to speed up the word to PDF conversion process. The Direct-to-PDF save method is already fast as compare to Legacy method, so I think there is no advantage of using these lines.

pdf.IsTruetypeFontMapCached = True<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath()

FYI, We have another product named Aspose.Pdf.Kit which is used to manipulate/edit exisitng PDF documents. It also offers the capability to add the PDF document information. In order to specify the product title information, you may try using this product. For more related information, please visit Change PDF Information.

In case it does not satisfy your requirments or you have any further query, please feel free to contact.

We are sorry for your inconveneicne.