Image Converter

No downloads or installation required!

Convert an image to a PDF using our free online app or learn how it works with our embedded iText 9 Sandbox.


Use the free online Image Converter app

Click the box below to upload an image, or drag and drop an image file into the box.

You can then choose the page size and margin settings for the resulting PDF. You can also choose if you want to rotate the image and set image position settings.

Margin settings and image position settings are specified in points (pt). Images in JPEG, JPEG2000, GIF, PNG, BMP, WMF, TIFF, CCITT and JBIG2 formats are supported.

Click Convert Image to PDF and then download the resulting PDF.

Or play in the iText Sandbox

In this Sandbox you can see how the the image conversion code works in iText 9, and experiment with changing the code yourself.

Click Upload File and make sure the file name of the image you upload matches the name you specify in private static final String ORIG.

Then click Execute to run your code. To remove an uploaded file, click the x displayed next to the file name.

You can click the switch at the top of the Sandbox to change between the embedded Java and C# compiler.

import com.itextpdf.io.image.ImageData; import com.itextpdf.io.image.ImageDataFactory; import com.itextpdf.kernel.pdf.PdfDocument; import com.itextpdf.kernel.pdf.PdfWriter; import com.itextpdf.layout.Document; import com.itextpdf.layout.element.Image; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.net.MalformedURLException; public class ConvertImageToPDF { private static final String ORIG = "/uploads/image.jpg"; private static final String OUTPUT_FOLDER = "/myfiles/"; public static void main(String[] args) throws FileNotFoundException, MalformedURLException { ImageData imageData = ImageDataFactory.create(ORIG); PdfDocument pdfDocument = new PdfDocument(new PdfWriter(OUTPUT_FOLDER + "ImageToPdf.pdf")); Document document = new Document(pdfDocument); Image image = new Image(imageData); image.setWidth(pdfDocument.getDefaultPageSize().getWidth() - 50); image.setAutoScaleHeight(true); document.add(image); pdfDocument.close(); } }
using iText.IO.Image; using iText.Kernel.Pdf; using iText.Layout; using iText.Layout.Element; namespace ConvertImageToPDF { internal class Program { private static string ORIG = "/uploads/image.jpg"; private static string OUTPUT_FOLDER = "/myfiles/"; public static void Main(string[] args) { ImageData imageData = ImageDataFactory.Create(ORIG); PdfDocument pdfDocument = new PdfDocument(new PdfWriter(OUTPUT_FOLDER + "ImageToPdf.pdf")); Document document = new Document(pdfDocument); Image image = new Image(imageData); image.SetWidth(pdfDocument.GetDefaultPageSize().GetWidth() - 50); image.SetAutoScaleHeight(true); document.Add(image); pdfDocument.Close(); } } }
Disclaimer:

iText does not analyze the content of your uploaded or processed files. Users bear sole responsibility for the usage and content of their own files. All uploaded and processed files are deleted from our servers after users leave the page, or automatically after a period of 3 hours.



Contact

Still have questions? 

We're happy to answer your questions. Reach out to us and we'll get back to you shortly.

Contact us
Stay updated

Join 11,000+ subscribers and become an iText PDF expert by staying up to date with our new products, updates, tips, technical solutions and happenings.

Subscribe Now