hi,
Aspose.Pdf.Document file = new Aspose.Pdf.Document(destFileName);
int index = 0;
byte[] pageBytes = null;
var watch = System.Diagnostics.Stopwatch.StartNew();
watch.Start();
for (int page = 0; page < file.Pages.Count; page++)
{
using (MemoryStream pageStream = new MemoryStream())
{
Aspose.Pdf.Document extractedPage = new Aspose.Pdf.Document();
extractedPage.Pages.Add(docfile.Pages[page + 1]);
HtmlSaveOptions htmlOptions = new HtmlSaveOptions();
htmlOptions.FixedLayout = true;
htmlOptions.PartsEmbeddingMode = Aspose.Pdf.HtmlSaveOptions.PartsEmbeddingModes.EmbedAllIntoHtml;
htmlOptions.RasterImagesSavingMode = Aspose.Pdf.HtmlSaveOptions.RasterImagesSavingModes.AsEmbeddedPartsOfPngPageBackground;
htmlOptions.RemoveEmptyAreasOnTopAndBottom = true;
htmlOptions.SplitIntoPages = false;
htmlOptions.SplitCssIntoPages = false;
string cssprefix = "aspose_pdf" + page;
htmlOptions.CssClassNamesPrefix = cssprefix;
extractedPage.Save(pageStream, htmlOptions);
pageBytes = pageStream.ToArray();
File.WriteAllBytes(Path.Combine(path, "HTML", index + ".html"), pageBytes);
index++;
}
}
Business problems and Solutions (1).pdf (1.5 MB)
Pdf to html converion is taking long time… May I know why the conversion is taking long? Is there any way to make the conversion faster
@pooja.jayan
Would you please share how much time the program is taking at your end in order to perform this conversion? Also, please share which API version are you using along with the information of your environment like OS Name and Version, Installed RAM Size, Application Type, etc.
Hi,
It took around more than ~120sec for the conversion on my side.
And I am using:
OS - Windows 10, version 21H1
RAM - 16.0 GB
Application Type - ASP.Net Core Console Application
and also ASPOSE.PDF package of version 22.5.0
@pooja.jayan
We are testing the scenario in our environment and will get back to you shortly.
1 Like
@pooja.jayan
We have tested the scenario using 23.3 version of the API and noticed that the API was taking 20-40 seconds while converting every page of the PDF. This was tested on a system having 8GB of RAM and Core i5 processor. Can you please check and share how much time does API take at your end while using the latest version? Also, please share the system details with us.
Hi can u do me a favour? C an u check the same on a system with RAM - 16.0 GB and i3 processor?
As I havenot upgraded the subscription, I cant use latest version.
And also is there anything we can do to reduce this conversion delay?and make it little more faster?
@pooja.jayan
We tested on Core i7 with 16G RAM size and noticed almost similar time while using 23.5 version of the API. Nevertheless, would you please share your expected time cost that you expect from the API for this whole process?
I am expecting this conversion has to be done in 3-5 sec.
@pooja.jayan
We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.
Issue ID(s): PDFNET-54706
You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
@pooja.jayan
We are afraid that the ticket has not been yet resolved. It was logged recently and will be resolved on a first come first serve basis. As soon as we make some progress towards its resolution, we will inform you. Please spare us some time.
We are sorry for the inconvenience.
Hi,
May I know why aspose.pdf -> aspose.html conversion is taking more time?
@pooja.jayan
Are you asking about the ticket updates? OR is it something about Aspose.PDF and Aspose.HTML APIs?
not about the ticket updates. I was asking about the conversion process
@pooja.jayan
We are afraid that we still could not understand. Do you mean PDF to HTML Conversion? Because Aspose.PDF to Aspose.HTML conversion does not make any sense.
PDF to HTML conversion using aspose
@pooja.jayan
It does not happen in every case as it depends upon many factors like installed memory, structure and complexity of file, etc. It may be related to the specific input document. The earlier logged ticket is for the purpose to investigate such reasons in your case. Regretfully, it is not yet resolved due to other pending issues in the queue. However, we will update you via this forum thread as soon as the ticket is resolved. Please spare us some time.
We are sorry for the inconvenience.