Hi, I want to load some jpeg images and convert them to a new PDF file in my .net project. Do you have a solution for this? Or is it possible for adding jpeg images to an existed PDF file? Any code is appreciated.
---- Lewis
Hi, I want to load some jpeg images and convert them to a new PDF file in my .net project. Do you have a solution for this? Or is it possible for adding jpeg images to an existed PDF file? Any code is appreciated.
---- Lewis
Hi, Lewis.
Our pqScan Image to PDF Library can resolve it for you. It supports to turn a list of jpg images to either a new PDF document of a made-ready PDF document in your .net project. What's more, no matter the jpeg image is compressed or not, our .net image to PDF control can distinguish the jpg graphics, and render this image graphs to a individual PDF page.
In the following C# code, we provide two examples to explain.
using System; using System.Drawing; using PQScan.ImageToPDF; namespace ImageToPDFQuestion { class Program { static void Main(string[] args) { passToNewPDF(); passToExistedPDF(); } private static void passToNewPDF() { //create a PDF converter object. PDFConverter pdfConverter = new PDFConverter(); //add a jpeg image to translating image list. string[] jpgImage = new string[1] { "sample.jpg" }; //set a name to a new pdf file. string fileName = "result.pdf"; //convert jpg images to a new PDF document. pdfConverter.CreatePDF(jpgImage, fileName); } private static void passToExistedPDF() { //create a PDF converter object. PDFConverter pdfConverter = new PDFConverter(); //add a jpeg image to translating image list. string[] jpgImage = new string[1] { "sample1.jpg" }; //navigate to an existed pdf file. string fileName = "result1.pdf"; //add jpg image to a existed pdf file. pdfConverter.AppendToPDF(jpgImage, fileName); } } }
Hope the C# code can be helpful.
---- pqScan Support Team
Copyright © pqScan 2010-2023. All Rights Reserved.