HTML to PDF conversion - set pdf page size to one page

@shif

We understand your concerns. We request you to please share a sample HTML that has custom fonts references inside it. We did not face any issue while converting the HTML into PDF which you have shared in this forum thread so far.

Please share a sample HTML that has custom fonts references so that we can perform detailed testing on it and share our feedback with you accordingly.

Could you please try the code below to convert the html file I sent you.
The file does not have custom fonts and I’d like to add them after this converts correctly.
When I run the code, the PDF layout is not good.
Can you send me the output if it is correct. If not, can you send me the code that will convert it.
The code should include ‘doc.DisableFontLicenseVerifications = True’, so I can add custom fonts.

Dim doc As Aspose.Pdf.Document = New Aspose.Pdf.Document()
doc.DisableFontLicenseVerifications = True
Dim currpage As Page = doc.Pages.Add()
Dim htmlFrag1 As HtmlFragment = New HtmlFragment(File.ReadAllText(newhtmlfileOutOfProject))
currpage.Paragraphs.Add(htmlFrag1)
doc.Save(strDestinationFilePDF)

Thank you

@shif

We were able to notice that using the above code snippet, the layout of the output PDF was not correct. An issue as PDFNET-50216 has been logged in our issue tracking system for the sake of correction. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as HTMLNET-3225) have been fixed in this update. This message was posted using Bugs notification tool by pavel.petrushechkin

@shif

We have added the new option which allows to create single page documents. The following code snippet shows how to use it:

using (var document = new Aspose.Html.HTMLDocument("input.htm"))
{
    var options = new Aspose.Html.Saving.PdfSaveOptions();
    options.PageSetup.PageLayoutOptions = PageLayoutOptions.FitToContentHeight;
    Aspose.Html.Converters.Converter.ConvertHTML(document, options, "out.pdf");
}