Ssues with a conversion from Word to PDF

Hello,

I have an with a conversion from Word to PDF using Aspose.pdf v4.1.0.0 and Aspose.Words 7.0.0.0.


The word file has 4 pages but the pdf created has 2 empty extra pages , 6 pages total.

I am attaching the file.

Thanks

Gaetano Tavano
MechWorks

Hello Gaetano,

Thanks for considering Aspose.

Please try using the Direct-to-PDF save method of Aspose.Words. During my test, I'm unable to notice the problem. The resultant PDF that I've generated is in attachment, please take a look.

Hello Codewarior,

thanks for the hint.

I did try the new method and indeed it worked better but I stll get 1 blank page.

I just used the sample code from the help file (see below)

Can you send me the code you used? Maybe it is some option?

I am attaching the pdf output I got.

private void button1_Click(object sender, EventArgs e)
{
Document doc = new Document(@"\\server1\e\temp\giorgio\aspose\09-0207.doc");

PdfOptions pdfOptions = new PdfOptions();
pdfOptions.HeadingsOutlineLevels = 3;
pdfOptions.ExpandedOutlineLevels = 1;

doc.SaveToPdf(0, doc.PageCount, @"\\server1\e\temp\giorgio\Rendering.SaveToPdfWithOutline Out.pdf", pdfOptions);
}

Hello Gaetano,

I've again tested the scenario using the following code snippet and I'm unable to notice the problem.

[C#]

Document doc = new Document(@"D:/pdftest/09-0207.doc");
Aspose.Words.Rendering.PdfOptions pdfOptions = new Aspose.Words.Rendering.PdfOptions();
pdfOptions.HeadingsOutlineLevels = 3;
pdfOptions.ExpandedOutlineLevels = 1;
doc.Save(@"D:/pdftest/09-0207_Direct.pdf", SaveFormat.Pdf);

and also I've used the following code snippet and I'm not able to reproduce the problem. The PDF is being generated correctly.

[C#]

Document doc = new Document(@"D:/pdftest/09-0207.doc");
Aspose.Words.Rendering.PdfOptions pdfOptions = new Aspose.Words.Rendering.PdfOptions();
pdfOptions.HeadingsOutlineLevels = 3;
pdfOptions.ExpandedOutlineLevels = 1;
doc.SaveToPdf(@"D:/pdftest/09-0207_Direct_2.pdf");

I'm not sure why you're using PdfOption? As I don't see it's effect over the resultant PDF document. During one of my test, I removed the code for setting PdfOption and the PDF is being generated correctly.