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

Free Support Forum - aspose.com

Problem with conversion file size


I am trying to take a PDF and save it as a Word 2010 compliant docx file. My main goal is to have it so the PDF can be opened in 2010 (or other office version) without opening in compatibility mode. I have this working, however the resulting docx file ends up being almost 2.5MB, even though the initial PDF was only 3KB (and was empty for the most part). Below is the code I’m using. I take the initial 3kb PDF and save it to docx with Aspose PDF, which results in a file size of 19KB. I then open that file with Aspose Words, set the compliance mode and save format, and save that file. The result can be opened in 2010 without being in compatibility mode, but results in a 2.5MB file. Is there an option I may be missing that is causing the file size to increase so much? Or a different way to go from PDF to compliant docx so it’s not in compatibility mode?


Aspose.Pdf.License license = new Aspose.Pdf.License();
Aspose.Pdf.Document pdfDoc = new Aspose.Pdf.Document(@“c:\temp\SmallPDF.pdf”); // file size is 3KB
Aspose.Pdf.DocSaveOptions saveOptions = new Aspose.Pdf.DocSaveOptions();
saveOptions.Format = Aspose.Pdf.DocSaveOptions.DocFormat.DocX;
saveOptions.Mode = Aspose.Pdf.DocSaveOptions.RecognitionMode.Flow;
saveOptions.RelativeHorizontalProximity = 2.5f;
saveOptions.RecognizeBullets = true;

pdfDoc.Save(@“c:\temp\PdfToDocxResult.docx”, saveOptions); // this file size ends up 19KB

Aspose.Words.License wordLicense = new Aspose.Words.License();

Aspose.Words.Document wordDoc = new Aspose.Words.Document(@“c:\temp\PdfToDocxResult.docx”);
Aspose.Words.Saving.OoxmlSaveOptions options = null;

options = new Aspose.Words.Saving.OoxmlSaveOptions(Aspose.Words.SaveFormat.Docx);
options.Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Transitional;
wordDoc.Save(@“c:\temp\NewDocx.docx”, options); // file size ends up 2,245KB

Hi Richard,

Thank you for contacting support. Please provide us your source PDF in this forum thread. It’ll help us to replicate the problem on our side. We’ll investigate and reply you appropriately. Your response is awaited.

Hi Imran,

Attached is the source PDF file.

Thanks for your help!

Hi Richard,

Thank you for the source PDF. We have tested your PDF against the latest versions of Aspose.Pdf and Aspose.Words APIs. Microsoft Office Word application generates an output Word document with 2.66 MB in size. Aspose.Words API mimics the behavior of Microsoft Office Word. It generates an output Word document with 1.08 MB in size. It appears as you are using an old version of the Aspose.Words API. Please download and use the latest version 16.11.0 of Aspose.Words API. Please let us know in case of any confusion or questions.

Hi Imran,

Thank you I will give that a try and see how it goes.

Hi Richard,

Sure, please take your time and let us know if you come across any problem. We'll help you appropriately.