/// <summary> /// Creates the PDF file. /// </summary> /// <param name="html">the HTML file as a byte array</param> /// <param name="baseUri">the base URI</param> /// <param name="dest">the path to the resulting PDF</param> public void CreatePdf(byte[] html, String baseUri, String dest) { ConverterProperties properties = new ConverterProperties(); properties.SetBaseUri(baseUri); PdfWriter writer = new PdfWriter(dest); PdfDocument pdf = new PdfDocument(writer); pdf.SetDefaultPageSize(new PageSize(595, 14400)); Document document = HtmlConverter.ConvertToDocument(new MemoryStream(html), pdf, properties); EndPosition endPosition = new EndPosition(); LineSeparator separator = new LineSeparator(endPosition); document.Add(separator); document.GetRenderer().Close(); PdfPage page = pdf.GetPage(1); float y = endPosition.GetY() - 36; page.SetMediaBox(new Rectangle(0, y, 595, 14400 - y)); document.Close(); }