Pdf to Html Support

Hi,


I am trying to convert pdf to html using aspose trial version. The output is quite good, whereas I was wondering if the extra spaces generated by page breaks could be reduced.

Find attached the documents.

Hello Muzna,

Thanks for using our API.

I have converted your PDF into HTML in our environment and observed the white space between page breaks. Though I have tried to reduce white spaces by editing PDF content before conversion but I did not get much success. For the sake of correction, I have logged an issue as PDFNET-42671 in our issue tracking system. We will further investigate the issue and keep you updated on the status of its resolution.

For your reference, I have tried following code snippet to edit the PDF content before conversion.

Document exportDoc = new Document(dataDir + “Securities Act Of 1933.pdf”);
foreach (Page p in exportDoc.Pages)
{
    p.PageInfo.Margin = new MarginInfo(0, 0, 0, 0);
}

Aspose.Pdf.Rectangle rect = exportDoc.Pages[1].Rect;
Facades.PdfPageEditor ppe = new Facades.PdfPageEditor();
ppe.BindPdf(exportDoc);
ppe.Zoom = (float)(rect.Width / rect.Height);
ppe.PageSize = new Aspose.Pdf.PageSize((float)rect.Height, (float)rect.Width);
exportDoc.Save(dataDir);

Please be patient and spare us a little time. We are sorry for the inconvenience.

Best Regards,

@Muzna_Tariq
To reduce whitespace margins between pages, use the HtmlSaveOptions.RemoveEmptyAreasOnTopAndBottom property:

using (Document exportDoc = new Document(dataDir))
{
    HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
    htmlOptions.PartsEmbeddingMode = HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
    htmlOptions.RasterImagesSavingMode = HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
    htmlOptions.LettersPositioningMethod = HtmlSaveOptions.LettersPositioningMethods.UseEmUnitsAndCompensationOfRoundingErrorsInCss;
    htmlOptions.RemoveEmptyAreasOnTopAndBottom = true; // Reduce empty space between pages
    // Conversion to HTML itself
    exportDoc.Save(dataDir + "Securities Act Of 1933_out.html", htmlOptions);
}