TCM i Kultura Prosta Spółka Akcyjna

libPDFToImage

A library utilizing PDFium to save a page of a PDF document as an image.

The library is designed for converting the pages of a PDF document to images in the format JPEG or PNG with specific dpi and pixel resolution. The executable program is not only a demo for showing how to utilize the library, but also a useful tool that runs on a terminal.

The library is released under GNU Lesser General Public License version 3.0, while the executable program is released under Apache License version 2.0.


Version 1.1.2 - Release Notes

Download source: libPDFToImage-1.1.2.tar.xz

Download binary for Linux (amd64): libPDFToImage-1.1.2-linux-amd64.tar.xz (Built using GCC 14.2, cmake and make; tested on Debian 13 for amd64)

Download binary for Linux (arm64): libPDFToImage-1.1.2-linux-arm64.tar.xz (Built using GCC 15.2, cmake and make; tested on 64-bit Raspberry Pi OS on Raspberry Pi 5)

Download binary for Windows 11 (amd64): libPDFToImage-1.1.2-win11-amd64.tar.xz (Built using MSYS2 MinGW-w64 GCC 15.2, cmake and ninja; tested on Windows 11 25H2)

Third-Party Libraries

The library dynamically uses PDFium library, libjpeg and libpng. And libjpeg is from libturbojpeg.

The libraries libturbojpeg and libpng are generally installed by default in Linux distributions. If they are not installed, please install the packages of libturbojpeg and libpng.

The PDFium library is distributed under Apache License version 2.0 (Copyright 2014 The PDFium Authors), and MIT License (Copyright 2014-2025 Benoit Blanchon).

Headers and binary of PDFium library: Please visit Binary distribution of PDFium and download the latest release for the system that you are using. For a 64-bit Linux distro on a x64/AMD64 CPU, it is pdfium-linux-x64.tgz; for a 64-bit Linux distro on an ARM64/AArch64 CPU, it is pdfium-linux-arm64.tgz. Before using libPDFToImage, please copy the library libpdfium.so into the folder of libPDFToImage's binary.

The libjpeg library is distributed under libjpeg-turbo Licenses (Copyright (C)2009-2025 D. R. Commander. All Rights Reserved. Copyright (C)2015 Viktor Szathmáry. All Rights Reserved.).

The libpng library is distributed under PNG Reference Library License version 2 (Copyright (c) 1995-2025 The PNG Reference Library Authors. Copyright (c) 2018-2025 Cosmin Truta. Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson. Copyright (c) 1996-1997 Andreas Dilger. Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.).

The binary for Windows is distributed with GCC runtime libraries and MinGW-w64 winpthreads library. GCC runtime libraries are distributed under GCC Runtime Library Exception. MinGW-w64 winpthreads library is distributed under MIT License and BSD 3-Clause Clear License (Copyright (c) 2011 mingw-w64 project. (C) 2010 Lockless Inc. All rights reserved.).


How to Use the Executable Program

pdfToImage <file> [options]

The path of a file or a directory should be enclosed in double quotation marks if there is a space in the path.

Options:

-o <directory>

The path of the folder for saving images.

Without the option, it is the current folder.

A subdirectory will automatically created in the given folder for saving images, and the subdirectory and images are automatically named based on the name of the PDF file.

-d

Generate images with a given dpi.

Without the option, images are generated with 96 dpi.

-s

Generate images with a given pixel size.

For example, "1920" means width pixels, or "x1080" means height pixels, and the size will be changed with the aspect ratio of the PDF page's original size; "1920x1080" restricts both of width and height regardless of the aspect ratio.

Without the option, the pixel resolution of images are decided according to the original size of images with 96 dpi.

-p

The first page is 1.

Page numbers are written like "1, 2, 3-5, -8, 10-" are acceptable.

Without the option, all pages will be saved to images.

-e

jpeg or png.

"jpeg" can be written as "jpg".

The processing of the formats depends on libjpeg and libpng in the system.

Without the option, the program saves images in the format of PNG.

-q

The quality for JPG/JPEG format.

Set a number between 1 and 100. 100 is the best quality.

TCM i Kultura Prosta Spółka Akcyjna

Article category:

TCM i Kultura Prosta Spółka Akcyjna © All rights reserved.