Free Support Forum - aspose.com

Not converting Word document

Hi,


I’m trying to convert a Word file to Pdf, but with this specific file, my code crashes when I want to get the PageCount of a document.

A test file is attached

This is my code:
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px 'Courier New'; min-height: 11.0px} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px 'Courier New'} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.5px 'Courier New'; color: #00901c} span.s1 {color: #3ba2bb} span.s2 {color: #2c26f9} span.s3 {color: #000000} span.s4 {color: #b22221}


Document document = new Document(inputFileName);


//it crashes on document.PageCount

ConvertEventArgs convertEventArgs = new ConvertEventArgs(0, document.PageCount);


Aspose.Words.Saving.PdfSaveOptions pdfOptions = new Aspose.Words.Saving.PdfSaveOptions();


string outputFileName = "output.pdf";


pdfOptions.PageIndex = 0;


pdfOptions.PageCount = document.PageCount;


document.Save(outputFileName, pdfOptions);


Can anyone please tell me if I'm doing something wrong?


Sincerely,


Geert-Jan Smulders

Hi Rogger,

Thanks for your request. I cannot reproduce the problem on my side. I used the latest version of Aspose.Words for testing. You can download the latest version from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Best regards,

Check. You guys already fixed it :slight_smile:


Sorry for bringing it up before checking the latest version.

Sincerely,

Geert-Jan