Hi,
Is there any way to set the page size when converting HTML to PDF
I've used your code from the demo page
PdfDocument doc = new PdfDocument();
doc.PageSettings.Size = PdfPageSize.A3;
String url = "http://www.bbc.co.uk";
Thread thread = new Thread(() =>
{ doc.LoadFromHTML(url, false, true, true); });
thread.SetApartmentState(ApartmentState.STA);
thread.Start();
thread.Join();
//Save pdf file.
doc.SaveToFile(Server.MapPath("~") + @"PdfFiles\Output\SimpleHTML.pdf");
doc.Close();
//Launching the Pdf file.
System.Diagnostics.Process.Start(Server.MapPath("~") + @"PdfFiles\Output\SimpleHTML.pdf");
Adding the line doc.PageSettings.Size doesn't seem to do anything as the page is always A4 portrait. Is this the right way or am I missing some code to change the page size. Alternatively how do I get the URL page to fit the output PDF page size.
thanks