Hi Team,
Hi Shanthi,
HtmlLoadOptions options = new HtmlLoadOptions();<o:p></o:p>
options.PageInfo.Margin.Left = 0;
options.PageInfo.Margin.Right = 0;
options.PageInfo.Margin.Top = 0;
options.PageInfo.Margin.Bottom = 0;
options.PageInfo.Width = 800;
options.PageInfo.Height = 3000;
var pdfDocument = new Aspose.Pdf.Document(@"D:\Downloads\StoFit\stofit.html",options);
/*
// Resize contents of resultant PDF
pdfDocument.ProcessParagraphs();
int[] page_cnt1 = new int[pdfDocument.Pages.Count];
for (int i = 0; i < pdfDocument.Pages.Count; i++)
page_cnt1[i] = i + 1;
PdfFileEditor pfe = new PdfFileEditor();
pfe.ResizeContents(pdfDocument, page_cnt1, PdfFileEditor.ContentsResizeParameters.PageResize(Aspose.Pdf.PageSize.A4.Width, Aspose.Pdf.PageSize.A4.Height));
*/
// Save output as PDF format
pdfDocument.Save(myDir+"stofit.pdf");
How can I be sure of my content height.
Hi Shanthi,
We would like to share with you that you can now convert HTML to Single Page PDF document using Aspose.PDF for .NET. In other words, you can now specify IsRenderToSinglePage property of HtmlLoadOptions Class in order to render HTML content on one page of PDF. Please consider using following code snippet:
HTML to PDF - Render all contents in single page
string outFile = "out.pdf";
HtmlLoadOptions options = new HtmlLoadOptions();
options.IsRenderToSinglePage = true;
Document doc = new Document("HTML/input.htm", options);
doc.Save(outFile);