How to set up a paper when converting from HTML to PDF

html to pdf.zip (803.4 KB)
As a result of converting HTML to pdf, the letters are out of the paper area, is there a way to set the paper area?

@emrods

Please use the latest version of Aspose.HTML for .NET 22.5 and following code example. Hope this helps you.

using (var document = new Aspose.Html.HTMLDocument(MyDir + @"test.html"))
{
    // Create the instance of Rendering Options
    var options = new Aspose.Html.Rendering.Pdf.PdfRenderingOptions();

    // Set the permissions to the file
    options.PageSetup.AdjustToWidestPage = true;

    // Create the PDF Device and specify options and output file
    using (var device = new Aspose.Html.Rendering.Pdf.PdfDevice(options, MyDir + "output.pdf"))
    {
        // Render HTML to PDF
        document.RenderTo(device);
    }
}

If you still face problem, please share the fonts used in your HTML here for testing. We will investigate the issue and provide you more information on it.

Do you have a sample of Aspose.HTML for JAVA?

@emrods

We suggest you please read the following article.
Convert HTML to PDF file

You can use following Java code example to achieve your requirement.

HTMLDocument document = new HTMLDocument(MyDir + "test.html");
// Create the instance of Rendering Options
PdfRenderingOptions options = new PdfRenderingOptions();

// Set the permissions to the file
options.getPageSetup().setAdjustToWidestPage(true);

PdfDevice device = new PdfDevice(options, MyDir + "output.pdf");

document.renderTo(device);

There is a broken Korean, is there a solution?encoding_break.JPG (204.0 KB)

@emrods

Please make sure that the fonts used for Korean text in your document are installed on the system where you are converting HTML to PDF.