Free Support Forum - aspose.com

Document PDF Convertion - slow

Hi Aspose Tech Support,

Currently I am testing Aspose products to convert word document into Pdf file by using Aspose.Words and Aspose.Pdf.

I have downloaded "Aspose.Words ver3.5.0.0" and "Aspose.Pdf ver3.0.0.0". and I am using Win Xp Prof and Visual Studio 2005.

I am testing PDF conversion to convert from a Word Doc into a Pdf file, however, it took 30 seconds to convert the word document into pdf file. I am just wondering, how fast is the Aspose API to convert a Word doc into a Pdf file?

Did I miss something, that makes the pdf conversion run really slow?

I am using this VB code to do the pdf conversion process.

----------------------------------------------------------------------------------

' Specify Aspose License.
Dim license As Aspose.Words.License = New Aspose.Words.License
license.SetLicense("Aspose.Custom.lic")

Dim pdf_license As Aspose.Pdf.License = New Aspose.Pdf.License
pdf_license.SetLicense("Aspose.Custom.lic")

Dim doc As Document = New Document("C:\Visual Studio\Projects\Test.doc")

' Save the document in Aspose.Pdf.Xml format into a memory stream.
Dim stream As MemoryStream = New MemoryStream()
doc.Save(stream, SaveFormat.FormatAsposePdf)

' Seek to the beginning so it can be read by XmlDocument.
stream.Seek(0, SeekOrigin.Begin)

' Load the document into an XmlDocument
Dim xmlDoc As XmlDocument = New XmlDocument()
xmlDoc.Load(stream)

' Load the XML document into Aspose.Pdf
Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()

' Make sure the images that were saved by Aspose.Words into Windows temporary
' folder are automatically deleted by Aspose.Pdf when they are no longer needed.
pdf.IsImagesInXmlDeleteNeeded = True

pdf.BindXML(xmlDoc, Nothing)

' Now produce the PDF file.
pdf.Save("C:\Visual Studio\Projects\Test.pdf")

----------------------------------------------------------------------------------

Thank you very much for you help.

Regards,

Jarry

Hi Jarry,

That is really unusual for Aspose Word to PDF conversion to take that long.

Please attach your test document - I will check it up.

Hi Vladimir,

please an attachment file of sample codes (Visual studio project files - VB).

Thank you.

Regards,

Jarry

Try inserting the following lines

pdf.IsTruetypeFontMapCached = True

pdf.TruetypeFontMapPath = Path.GetTempPath()

after

pdf.BindXML(xmlDoc, Nothing)

Hi Vladimir,

It works great, the process takes 1 second for 10kb word doc, and 5 seconds for 650kb word doc.

Could you please explain me, what does it (the additional code) do?

And I am just wondering if you have another tricks to make it even faster :)

Because currently, I have a project to generate 100,000 word docs into pdf files in one day. So, I am really aiming good APIs with the best pdf file conversion process speed :)

Thank you very much for your help.

Regards,

Jarry

Unfortunately, I am out of tricks for now. Try to ask Aspose.Pdf team. Maybe they will provide more tips on speeding up the conversion.

Thanks Vladimir,

for your help.

Regards,

Jarry