Convert Image to pdf
Code for how to convert a image to pdf
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.
Hussam BarouqaPosted Apr 13, 2017, 11:14 AM
The most direct approach you could consider is to convert the HTML page into a rasterized image then save it as a PDF. This will maintain the overall design and images in the page. If you want to also keep text selectable after doing this, you could perform OCR on the result.
To convert an HTML page into PDF, there is .NET code you can implement as a service:
RasterCodecs codecs = new RasterCodecs();
codecs.convert("input.html", "output.pdf", RasterImageFormat.RasPdfJpeg411, 0, 0, 0, null);
If you want to maintain the text during conversion, another thing you can try is the DocumentConverters class:
using (DocumentConverter documentConverter = new DocumentConverter())
{
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);
}
Check out this forum topic for more features that can be implemented with ASP.NET MVC, including OCR:
https://www.leadtools.com/support/forum/posts/m41793-HTML5-Projects-with-ASP-NET#post41793
alice yangPosted Apr 6, 2017, 10:13 PM
Uehara AyakaPosted Apr 6, 2017, 10:10 PM
Sidhartha PatnaikPosted Apr 6, 2017, 8:51 AM
Sidhartha PatnaikPosted Apr 6, 2017, 8:51 AM
Rajeesh sir,
Ranjeet PatraPosted Apr 6, 2017, 8:33 AM
Rajeesh MenothPosted Apr 6, 2017, 7:16 AM