# jpeg2pdf – Convert JPEG Files to PDF

Version: 2.0.0

Part of DaVince Tools

Last Modified: December 13, 2001

Command Syntax

Description

New Features / Changes

Additional Information

About DaVince Tools

## Command Syntax

(Please note that the square brackets "[" and "]" specify optional parameters; do not enter the brackets as part of the command)

jpeg2pdf [-1] [-c commandfile] [-f] [-i key:value [-i key:value]] [-o outputfile] [-p profile] [-r] [-s] [-?] [file1 file2 ...] [dir1 dir2 …]

Arguments:

-1: (numeric "one") Create a PDF file for each JPEG file specified on the command line (one to one relationship). For each JPEG file specified, a PDF file is created in the same directory with the same name except with a ".PDF" extension. A PDF file is not created if one already exists and is newer than the corresponding JPEG file. To force a PDF file to be created, use the "-f" option. The default is to take all specified files and combine them into a single PDF file (many to one relationship). The behavior of the "-o" option changes when using the "-1" option, as described below.

-c: Process commands in the specified command file. When using this argument, files and directories can be specified via a file instead of on the command line. Click here for more info on command files.

-f: When used with the "-1" option, force overwriting an existing PDF file. By default, a PDF file may not be created with the "-1" option if the JPEG file is unchanged since the last time the PDF file was created.

-i: Specify Info dictionary attribute values like title and author of document. The following attributes are available for use:

Attribute | Description
Author | The name of the person who created the document.
Keywords | Key words associated with the document.
Subject | The subject of the document.
Title | The title of the document.

Note that the attribute names are case sensitive (first character in uppercase). This option can be specified multiple times when setting multiple dictionary attribute values. To specify an attribute along with its data, separate the two with a colon ":". You will need to enclose the string in quotes if there are spaces in the data. For example, to set the title of a document to "The Declaration of Independence", use the following parameter:

-i "Title:The Declaration of Independence"

In addition to these tags, custom tags can be used with this option; however, Acrobat Reader will not recognize them. The "CreationDate" and "Creator" attributes are automatically filled in by the program and cannot be overridden with this option.

-o: This meaning of this option varies depending on if the "-1" (numeric "one") option is used. When "-1" is used with this option, this specifies an alternate directory to use when creating the PDF files (new in version 1.2). When "-1" is not used with this option, this specifies the file name to use for the newly created PDF file. The ".pdf" extension should be included when specifying a filename. If the "-o" option is not used when "-1" is specified, then by default the PDF file is created in the same directory as the JPEG file. If the "-o" and "-1" options are not used, the filename "jpeg.pdf" in the current directory is assumed.

-p: Specify a profile to use in the creation of the PDF file. Profiles contain conversion information such as bookmark and compression settings and reside in the "jpeg2pdf.ini" file located in either the directory where the executable file resides or the windows base directory (typically "C:\WINDOWS" for Windows 9x, "C:\WINDIR" for Windows NT). If the file is present in both directories, the file located in the windows base directory takes precedence. The default profile "default" is used when this option is not specified.

-r: When a directory is specified, search subdirectories (recursive search).

-s: Sort the filenames specified on the command line in alphanumeric order before processing them. Note that when a directory is specified on the command line, files in that directory are always sorted.

-?: A brief summary of arguments is displayed.

[file1 file2 …]: Specify one or more JPEG files to convert. Wild card characters such as "*" and "?" may be used. The "-d" parameter can be used in conjunction with this option.

[dir1 dir2 …]: Specify one or more directories to convert. All JPEG files in this directory should end in either ".jpg", or ".jpeg". Files are converted in alphanumeric order. Use the "-r" option to include subdirectories.

##

## Description

"jpeg2pdf" is a command line program that converts JPEG files to PDF (Portable Document Format) files. JPEG is a file standard used primarily for photographic images. The program takes the raw image data from the JPEG file "as is" and puts it in a PDF wrapper. This analogous to removing a letter from a letter size envelope and placing it in a business size envelope. The original image data is unaltered, so no data compression of the image is done (although the page description can be compressed using the "compression" option in the jpeg2pdf.ini file). The key features of this program are:

- JPEG file formats JFIF and ITU T.81 supported
- Single and multi-page file support
- Bookmark support
- Convert many JPEG files to one PDF or create a PDF file for each specified JPEG file
- RGB, Grayscale and CMYK JPEG files supported
- Quick conversion of data by utilizing existing compressed image data
- Individual filenames with wildcard support and/or an entire directory may be specified for conversion
- Specify files or directories to convert either via the command line or a command file
- Large file support (1,000+ pages)
- Creates a version 1.2 PDF file with a unique file ID in trailer

The height, width and resolution information embedded in the JPEG file are used to determine the physical page size. For example, an image 2,544 pixels wide and 3,287 pixels long and scanned at 300 DPI results in a PDF page size of 2,544/300 by 3,287/300, or 8.48 inches wide by 10.96 inches long. The resulting page size may not match a standard paper size, however, this is not a problem for viewers like Adobe Acrobat. The advantage to this method is that a multiple page conversion can contain images scanned at different sizes. This allows, for example, a converted PDF file to contain both U.S. letter and legal size pages, as well as differing European sizes (A1, A2, etc.) or even a combination of the two.

The screen output can be redirected to a file adding the DOS syntax ">filename" to the end of the command line. This can be used to redirect output to a log file. The program returns an error code of 1 when a fatal error occurs, used in batch programs to test the success of the program.

The program options are specified either on the command line or in a profile stored in the initialization file. Command line options are typically file related directives, whereas the profile settings are conversion related directives. Profile settings are stored in the initialization file "jpeg2pdf.ini", located in either the executable file's directory or the Windows’ root directory (typically "C:\WINDOWS" for Windows 9x and "C:\WINNT" for Windows NT/2000). If both files are present, the file in the Windows' root directory takes precedence. The file is divided into profiles, which can be specified by name on the command line. A profile begins with the name of the profile surrounded by square brackets. An example file is shown below:

`

[default]

`
`bookmark=yes`
`defaultdpi=300`
`compression=yes`

Multiple profiles can exist in the file. The "-p" command line option determines which profile the program will use. Profile names are case sensitive. If no profile is specified on the command line, the default profile ("[default]") is used. . Default profile options can be overwritten by defining them in the "_common" profile.

Several option statements can appear after the profile line. These option statements have the following syntax:

option=value

Where option is the name of valid option (see below) and "value" is the value for the option. Depending on the option, "value" can be a number, a string or a Boolean value. The following values are all valid for a Boolean value:

Valid True Values | Valid False Values
True, T, On, Enable, Yes, Y | False, F, Off, Disable, No, N

These values are case insensitive (i.e. both "true" and "TRUE" are valid).

## Common Profile Settings

The following table describes options allowed in the jpeg2pdf.ini file that are common to all "DaVince Tools" converters (options are case insensitive):

Option | Data Type | Description
Bookmark | Bool | When true, create a bookmark for each file converted
BookmarkFilenameExtension | Bool | When true, include filename extension (usually ".jpg" or ".jpeg") in the bookmark name. Otherwise, ignore it. The default is false.
Compression | Bool | When true, compress the page description (image data is always compressed). The default value is false.
Description* | Description of Profile (string) | Description of profile. This description is displayed in the Windows version of "DaVince Tools"
FileMatch | String | This parameter allows setting a default file match pattern when specifying a directory to convert. This is a comma delimited list of file matching patterns. The default setting is "*.jpg,*.jpeg"
OpenAction | Fit, FitH, FitV, None | This parameter describes how to view the first page of the newly created PDF file when opened. Choices are "Fit" to fit entire page, "FitH" to fit the horizontal width of the page, "FitV" to fit the vertical width of the page, or "None", which defaults to the setting defined in the PDF viewer. The default setting is "None".

* - new in version 2.0

Converter Specific Settings

This tables describes jpeg2pdf.ini settings that are unique to this converter:

Option | Data Type | Description
DefaultDPI | Number (in dpi) | Default resolution (in dots per inch) to use if the resolution is not specified in the JPEG file. Default value is 150.

## New Features / Changes:

A list of new features and changes, along with a version history, can be found in the release notes.

## Additional Information:

Any DaVince Tool product that creates a PDF must create an intermediate file prior to writing the PDF file. The filename of this intermediate file begins with "tmps" and appears in the directory pointed to by the environment variable "TMP". If this environment does not exist, then the temporary file is written in the current directory. The intermediate file exists only during the execution of the program.

##

## About DaVince Tools:

Visit the DaVince Tools web site at http://www.davince.com for the latest version of this software and the latest documentation. DaVince Tools is shareware and software registration is urged if you find these programs useful. You can register the software on-line at http://www.davince.com.

DaVince Tools

was written in C++ using the DaVince Class Library, written by the same author as this program. The DaVince Class Library is a C++ library for developing PDF and TIFF applications. Contact the author at info@davince.com for more information on the availability of the class library.