How to convert image to PDF of a specific page size with command line

If you want to convert image to PDF of a specific page size, the command line application Image to PDF OCR Converter will be a good choice for you.

PDF (Portable Document Format) is a popular file format that can transfer data electronically without making any changes to the text, image, format, etc. Thus, it’s widely used in archiving, distributing and sharing documents among friends, colleagues, business partners, etc. Sometime, you may need to convert your images to PDF for easy upload and sharing.

Image to PDF OCR Converter is an easy-to-use command line application that can convert JPG, PNG, GIF, PCD, PSD, TGA, BMP, TIF, DCX, PIC, EMF, WMF, etc. image formats to PDF. What’s more, it supports to set page size, resolution, etc. for the created PDF document.

In the following paragraphs, you will see how to use this command line application to convert an image file to PDF and specify page size for the created PDF.

Firstly, please free download Image to PDF OCR Converter and unzip it to a folder on the computer. In the unzipped package, there an executable file named img2pdfocr.exe which is the called program in the MS-DOS command prompt window.

Then, please open MS-DOS command prompt window in which you can input commands. In the opened MS-DOS command prompt window, please refer to the following command line template to input your commands.

img2pdf [options] <Image-file> [<PDF-file>]

To know the meanings of the parameters in the above command line template, please read the following explanations;

  • img2pdf: call the program.
  • [options] : set parameters to control the conversion.
  • <Image-file>: specify the input image.
  • [<PDF-file>]: specify the output PDF file

To set page size for the PDF file, you can use the following options: -width <int> which is used to set page width to PDF file and -height <int> which is used to set page height to PDF file.

For example,

D:\img2pdfocr\ img2pdfocr.exe -width 500 -height 300 D:\us.png E:\us.pdf

This example is to convert a PNG image to PDF and set PDF page width and height as 500 and 300 respectively.

Lastly, please press Enter on your keyboard to run the commands.

Seconds later, you can get specific page size PDF file in the specified folder.

This is the end of this article and you can enjoy full version of Image to PDF Converter here.

Related Posts: