Posted by a ceTe Software moderator
Hello,
You can set the page size using the HtmlconversionOptions class of DynamicPDF Converter API. You will need to create HtmlconversionOptions class object by specifying the desired dimensions for the page and apply this conversion options for conversions. You can refer to the documentation on conversion options
here. Please note that it is not possible to add page breaks while converting the HTML file to PDF using DynamicPDF Converter API but if you have added the page breaks in the HTML file then it should work for you. Below is the code sample for setting page dimensions and converting HTML text having page breaks.
string htmlText = "<style>.break { page-break-before: always; }</style><body>Sample content on page 1...<h1 class='break'>text of Heading 1 on page 2</h1>content on page 2...</body>";
HtmlConversionOptions options = new HtmlConversionOptions(ceTe.DynamicPDF.Conversion.PageSize.Letter, ceTe.DynamicPDF.Conversion.PageOrientation.Portrait, 20);
Converter.ConvertHtmlString(htmlText, @"C:\temp\Outputconverter.pdf",options);
Thanks,
ceTe Software Support Team.