Is there a way to convert a HTM file to a PDF? Based on my understanding, HTML and HTM file extensions are the same. With that in mind, I tried the following code using Spire but my output was a blank PDF.
if (filelist[f].EndsWith(".htm"))
{
PdfDocument doc = new PdfDocument();
string filext = System.IO.Path.GetExtension(filelist[f]);
string outputDocName = filelist[f].Replace(filext, ".pdf");
doc.SaveToFile(outputDocName);
doc.Close();
}
I have searched on Google but I couldn't find much on converting a HTML file to a PDF. I have even looked into Python using ImageMagick, but there is multiple steps, so will try that once I run out of options. Is iTextSharp a possibility? Do I need to do another conversion to the HTM file to another file type before turning that into a PDF or for what I am trying to do doesn't exists?