Aspose.Pdf

Speed up Word to PDF conversion

A lot of customers have experienced that while converting a Word document to PDF, the conversion process takes a considerable amount of time to complete. In order to speed up this process you should add the following lines of code:

[C#]

//Enable the caching of True type font map on disk
pdf.IsTruetypeFontMapCached = true;

//Set the path of True type font map file
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath();

[VB.Net]

‘Enable the caching of True type font map on disk
pdf.IsTruetypeFontMapCached = True

‘Set the path of True type font map file
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath()

Above lines should be added before the Aspose.Pdf.Save() method is called. For example:

[C#]

//Instantiate the Word Document Object
Aspose.Words.Document doc = new Aspose.Words.Document("WordDocument.doc");

//Save the Word Document in XML Format that can be handled by Aspose.Pdf
doc.Save("XMLDocument.xml", SaveFormat.FormatAsposePdf);

//Instantiate a Pdf Document Object
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

//Bind XML document With Aspose.Pdf Object
pdf.BindXML("XMLDocument.xml", null);

//Add these two lines to Speed up the conversion
pdf.IsTruetypeFontMapCached = true;
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath();

//Save PDF
pdf.Save("PDFDocument.pdf");

[VB.Net]

'Instantiate the Word Document Object
Dim doc As Aspose.Words.Document = New Aspose.Words.Document("WordDocument.doc")

'Save the Word Document in XML Format that can be handled by Aspose.Pdf
doc.Save(“XMLDocument.xml”, SaveFormat.FormatAsposePdf)

'Instantiate a Pdf Document Object
Dim pdf As Aspose.Pdf.Pdf = New Aspose.Pdf.Pdf()

'Bind XML document With Aspose.Pdf Object
pdf.BindXML(“XMLDocument.xml”, Nothing)

'Added these two lines to Speed up the conversion
pdf.IsTruetypeFontMapCached = True
pdf.TruetypeFontMapPath = System.IO.Path.GetTempPath()

'Save PDF
pdf.Save("PDFDocument.pdf")