Transform DOCX file to PDF

I need to transform an docx file to pdf file format.

the conversion must be executed server side only

i have the following exception (found in the windoiws event logs) :
Start failed! Startxref not found. (log: before new
Aspose.Pdf.Generator.Pdf();after new Aspose.Pdf.Generator.Pdf();before new
Aspose.Pdf.Document(temp):wink:

my c# code :

Document doc = new Document(Server.MapPath("/in.docx"));
string outFile = Path.Combine(Path.GetTempPath(), “out.pdf”);
doc.Save(outFile);

in attachments, the docx file and pdf result

the transformation is good.
the problem is “just” the exception

thanks a lot for your help

regards

Hi John,

Thanks for your inquiry. There is no issue with Aspose.Words API. The Aspose.Words.Document class is used for Word document and Aspose.Pdf.Document class is used for Pdf.

The shared exception is related to Aspose.Pdf. Please share the input Pdf and code here for testing purposes. I am moving this forum thread to Aspose.Total forum. My colleagues from Aspose.Pdf team will reply you about the shared exception.

Hi John,


Thanks for your inquiry. Please note Aspose.Pdf supports PDF to DOC(X) conversion and whereas Aspose.Words supports DOC(X) to PDF. So if you need to convert DOC(X) to PDF then please use Aspose.Words for the purpose. You are getting exception due to unsupported file format, so using appropriate DLL for the required conversion will resolve the exception issues.

Please feel free to contact us for any further assistance.

Best Regards,