below is my code in c#:
- Code: Select all
PdfDocument doc = new PdfDocument();
PdfPageSettings settings = new PdfPageSettings();
Spire.Pdf.PdfPageSettings pdfse = new PdfPageSettings();
pdfse.Orientation = PdfPageOrientation.Landscape;
SizeF sizeff = new SizeF(browse.Document.Body.OffsetWidth, 1100);
pdfse.Size = sizeff;
doc.PageSettings = pdfse;
//pset.PaperSize = pdfse;
//doc.PageSettings = pset;
doc.LoadFromHTML(browse.Url.AbsoluteUri,false, true, false, settings);
doc.PrintDocument.DefaultPageSettings.Landscape = true;
PaperSize psizee = new PaperSize();
psizee.Height = (int)sizeff.Height;
psizee.Width = (int)sizeff.Width;
doc.PrintDocument.DefaultPageSettings.PaperSize = psizee;
//psize = doc.PrintDocument.DefaultPageSettings.PaperSize;
//psize.Width = bp.Width;
//doc.PrintDocument.DefaultPageSettings.PaperSize = psize;
doc.SaveToFile("FromHTML.pdf");
doc.Close();
I just want to grab all the page visible area so i may print it.