We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Image not visible in regeneration of Pdf from html

Hi Team,

I am converting PDF file into HTML with Images saved in different folder…and I am getting perfect HTML.
Now When I am trying to regenerate PDF back from that HTMl with Images folder…I am not able to get Images in PDF.

This is the code I am using…

Aspose.Pdf.Document pdf = new Aspose.Pdf.Document(Root + “Data.pdf”);
Aspose.Pdf.HtmlSaveOptions options = new Aspose.Pdf.HtmlSaveOptions();
options.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedCssOnly;
options.SpecialFolderForAllImages = Root + “Images”;
options.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
Console.WriteLine(“File was Opened”);
pdf.Save(Root + “generated.html”, options);
HtmlLoadOptions objLoadOptions = new HtmlLoadOptions();
objLoadOptions.PageInfo.Margin.Bottom = 0;
objLoadOptions.PageInfo.Margin.Top = 0;
objLoadOptions.PageInfo.Margin.Right = 0;
objLoadOptions.PageInfo.Margin.Left = 0;

        Aspose.Pdf.Document pdf_html = new Aspose.Pdf.Document(Root + "generated.html", objLoadOptions);
        pdf_html.Save(Root + "regenerated.pdf");

can you please guide me how to include Images folder at the time of regeneration?


Thanks for contacting support.

You may please specify directory path of images inside HtmlLoadOptions as follows:

HtmlLoadOptions objLoadOptions = new HtmlLoadOptions("Path to Images");

In case this does not help, please share your sample HTML data in ZIP package. We will test the scenario in our environment and address it accordingly.

Hi @asad.ali,

HtmlLoadOptions objLoadOptions = new HtmlLoadOptions(“Path to Images”);

This is taking too long to regenerate file…
is there any other way to load images from different folder or reduce conversion time?


Thanks for getting back to us.

Please note that the performance of the API may depend upon several factors including size of data and complex structure of a document. In case you are observing any delay while generating PDF document from particular HTML input, please share that HTML data in a ZIP Package with us. We will test the scenario in our environment and address it accordingly.