Convert very large JPEG images to PDF 4

XFINIUM.PDF 6.7 brings support for JPEG to PDF conversion with very low memory consumption for very large images (hundreds of megabytes).

Very large JPEG images (hundreds of megabytes) can be converted to PDF using only a few megabytes of memory, assuming that both the input JPEG image and the output PDF file are stored on disk.
The new class for handling these images is called PdfXLJpegImage and it is used just like its sibling class PdfJpegImage.
The constructor of PdfXLJpegImage class takes a Stream as parameter and the only requirement is that this Stream is available till the PDF file is generated.
The conversion of very large JPEG images to PDF using the PdfXLJpegImage class is shown below:

If you want the library to dispose the jpeg stream after the PDF file was created, so that you don’t have to keep track of it, you can set the second parameter of the PdfXLJpegImage constructor to true.

This class can be used to convert any JPEG images to PDF, not just very large ones. In fact, if you have to convert many JPEG images to PDF (for example you create a photo album), this class can help lower the memory usage.

Download the new version of XFINIUM.PDF library and give it a try. If you have questions, you can always contact us.

4 thoughts on “Convert very large JPEG images to PDF

  1. Reply Tomislav Jakopović May 15,2017 11:20 am

    Hi,

    Do you have plans to support this for Tiff version as well?

  2. Reply Tomislav Jakopović May 17,2017 12:43 pm

    What is the maximum tested size of the jpeg file?

    • Reply xfinium.pdf May 17,2017 1:25 pm

      We tested with a 700MB JPEG image, it is the largest one we could find. If you have a larger image, feel free to share it with us and we’ll test it.

Leave a Reply