Hi Alexey,
Conitnuing from the previous post already logged in following thread
If u go to above URL the issue #1 is further discuss in this post.
Still i will explain you the problem in detail here again.
I am facing a problem while converting a word document into PDF format.My word document is consist of 3 pages but my PDF document is consist of only 2 pages.
The third page contents are missing from PDF report
Please refer attached document as (Pdf_doc.pdf & Word_doc.doc)
I am currently using Aspose Word version 7.0.0.0.
I am using following API for converting word document into PDF format.
reportDocument.SaveToPdf(0, reportDocument.PageCount, elementDoc, null);
//Here elementdoc is memorystream .
As you told me in previous thread that you can’t replicate the problem at your end & you can generate the PDF document sucessfully.
I have more update on this issue.
This issue is caused because of implementation of footer code for displaying page nos. in document.
The sample code is as follows.
private void button16_Click(object sender, EventArgs e)
{
string path = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath);
//Initialize Aspose license.
Aspose.Words.License lic = new Aspose.Words.License();
lic.SetLicense(path + @"\Aspose.Total.lic");
Aspose.Pdf.License lic1 = new Aspose.Pdf.License();
lic1.SetLicense(path + @"\Aspose.Total.lic");
Document doc = new Document();
DocumentBuilder documentBuilder = new DocumentBuilder(doc);
Section currentSection = documentBuilder.CurrentSection;
PageSetup pageSetup = currentSection.PageSetup;
//go to document end.
documentBuilder.MoveToDocumentEnd();
//set the page size.
pageSetup.PaperSize = PaperSize.A4;
//apply new page margin
pageSetup.LeftMargin = 100;
pageSetup.RightMargin = 100;
pageSetup.TopMargin = 100;
pageSetup.BottomMargin = 100;
//set the header margin.
pageSetup.HeaderDistance = 3;
documentBuilder.MoveToDocumentEnd();
//Implementation for footer.
pageSetup.DifferentFirstPageHeaderFooter = false;
currentSection.HeadersFooters.LinkToPrevious(false);
documentBuilder.MoveToHeaderFooter(HeaderFooterType.FooterPrimary);
//Print Page X of Y
//print first text [Page]
documentBuilder.InsertHtml("");
//Insert Page Field
documentBuilder.InsertField("PAGE", "");
//print first text [Of]
documentBuilder.Write(" of" + " ");
//Insert Total Page Field
documentBuilder.InsertField("NUMPAGES", doc.PageCount.ToString());
//move to main document.
documentBuilder.MoveToDocumentEnd();
documentBuilder.StartTable();
documentBuilder.InsertCell();
documentBuilder.Writeln("This is a sample document");
documentBuilder.EndRow();
documentBuilder.EndTable();
//Move to end of document
documentBuilder.MoveToDocumentEnd();
// StartWord("aa.doc");
// doc.Save("aa.doc");
doc.SaveToPdf("aa.pdf");
StartPdf("aa.pdf");
}
}
The Sample document generated from above code is also attached with this post ( please refer attachment as sample.doc & Sample.pdf )
The lines which are causing the problem is highlighed in RED color. if you comment out these lines from above code then PDF document is also get generated sucessfully.
I think you can replicate the same problem at you end with this sample code.
If you can replicate the problem at your end then how much amount of time it will take to fix this issue?
Waiting for your reply.
I am also having some doubts which are as follows.
1> This issue( discussed above is not there in Aspose.Word 6.2.0.0 & Aspose.PDF version 3.9.0.0 with legacy method ( refer attachment as Old_Method_WordToPDF.txt) Is it a compatibility issue?
2> Is it advicable to use the old legacy way to convert word to pdf document?
3> your future version of aspose will be compitable with old method or new method for converting word document into pdf format
Please suggest us proper way so that we can solve our all issue as earliest.since we have major release in this month.
Please Send me more updates on same issue wheather your able to reproduce above problem at your end.
Thanks & Regards,
Dwarika