Convert html to pdf using command prompt in console app.
How to Convert HTML which contains image also to pdf using command prompt in console app.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Bikesh SrivastavaRank #108 · 20.3K reputationPosted Oct 13, 2016, 4:57 AM EDT
alice yangRank #2,329 · 607 reputationPosted Oct 16, 2016, 6:08 PM EDT
Convert HTML to PDF with New Plugin
Maen BadwanRank #2,520 · 556 reputationPosted Nov 3, 2016, 7:55 AM EDT
You can use LEADTOOLS DocumentConverter class to convert your HTML (and other document or image files) to PDF. You can find more details here:
https://www.leadtools.com/help/leadtools/v19/dh/doxc/leadtools.documents.converters~leadtools.documents.converters.documentconverter.html
The code will be something as follows:
+----------------------+
public void DocumentConverterExample()
{
using (DocumentConverter documentConverter = new DocumentConverter())
{
var inFile = Path.Combine(ImagesPath.Path, @"input.htm);
var outFile = Path.Combine(ImagesPath.Path, @"output.pdf");
var format = DocumentFormat.Pdf;
var jobData = DocumentConverterJobs.CreateJobData(inFile, outFile, format);
jobData.JobName = "conversion job";
var job = documentConverter.Jobs.CreateJob(jobData);
documentConverter.Jobs.RunJob(job);
if (job.Status == DocumentConverterJobStatus.Success)
{
Console.WriteLine("Success");
}
else
{
Console.WriteLine("{0} Errors", job.Status);
}
}
}
+----------------------+
Disclaimer: I am an employee of this library
Pacak13 reputationPosted Nov 28, 2016, 10:21 PM EST