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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
PacakPosted Nov 29, 2016, 3:21 AM
Maen BadwanPosted Nov 3, 2016, 11:55 AM
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
alice yangPosted Oct 16, 2016, 10:08 PM
Convert HTML to PDF with New Plugin
Bikesh SrivastavaPosted Oct 13, 2016, 8:57 AM