Custom PDF Size
This code snippet illustrates how to define custom paper size when rendering HTML content into a PDF document.
Use the paperSize
property to customize paper size in the rendering options. The options object is used to specify the custom paper size, setting it to a custom 5x5-inch dimension. You can adjust the height and width properties as needed to match your desired paper size.
Utilize the PdfDocument.fromHtml
method from the IronPDF library to convert the HTML content into a PDF document while applying the specified rendering options.
After rendering, the resulting PDF document is saved with the custom paper size using the saveAs
method.