SourceFiles.org - Use the Source, Luke
Home | Register | News | Forums | Guide | MyLinks | Bookmark

Related Sites

Latest News
  General News
  Reviews
  Press Releases
  Software
  Hardware
  Security
  Tutorials
  Off Topic


Back to files
img2pdf 0.5 of 23 February 2003

Description

In its current incarnation, img2pdf simply takes a specified list of image files (which are assumed to be page-sized and oriented properly) and converts them to a PDF document called "output.pdf" using the Panda PDF library. PNG, TIFF and JPEG image types are supported, assuming the corresponding libraries were available when Panda was compiled.

For example, the US Patent and Trademark Office publishes patent applications after 18 months, and its server makes the formatted applications available only as single-page TIFF images. These may be downloaded and named appropriately (e.g., "page01.tiff" ... "page23.tiff"), then converted to PDF as follows:

       % img2pdf page*.tiff
       % mv output.pdf some-other-name.pdf

Images need not all be of the same type; img2pdf checks the file extension of each one and calls the appropriate Panda function.

Bugs / Limitations

There is no -o option to specify the filename of the output PDF.

US letter-size format is assumed. A4 is supported by changing "panda_pagesize_usletter" to "panda_pagesize_a4" near line 108 in img2pdf.c.

Images are assumed to be images of pages rather than images to be placed on pages; there is no support for centering, rotating, or differentially scaling them. (That is, all images will be scaled as necessary to fit the full height and width of the default paper size.) Note that the Panda library itself does support all of these things, so one could write a specialized app to place four portrait-oriented photographs on each page with 1cm white margins, for example. Then again, there are many other applications that do such things...

A file called panda.tdb also gets created, at least with Panda 0.5.1; this appears to be an intermediate file used by the library during generation of the PDF, and its non-deletion is almost certainly a bug. (Feel free to delete it; it's not needed once the PDF file is created.)

Installation

Panda is a prerequisite; it is currently available here:

http://www.stillhq.com/cgi-bin/getpage?area=panda&page=index.htm

Panda, in turn, requires libpng, libtiff, and libjpeg in order to support the corresponding image formats, and libpng requires zlib. (libtiff can optionally be compiled with libjpeg and zlib support, too.) All of these libraries are usually present on Linux, *BSD and Cygwin systems, but they can also be obtained from the following sites:

        http://www.libpng.org/pub/png/libpng.html
        http://www.libtiff.org/
        http://www.ijg.org/
        http://www.zlib.org/

Once they're compiled and installed, edit the Makefile to point at their locations (and to specify your compiler if it isn't GNU C), then simply:

make

Since Panda isn't widely available and some image libraries have version incompatibilities between different systems, the default build makes both a dynamically linked executable and a statically linked one (that is, statically linked against the five libraries listed above, not against the C or math libraries).

Once compilation/linking succeeds, simply copy the img2pdf binary of your choice to an appropriate directory in your path (e.g., /usr/local/bin).

ChangeLog

0.5 is the initial release.

Greg Roelofs
25 February 2003


Other Sites

Discussion Groups
  Beginners
  Distributions
  Networking / Security
  Software
  PDAs

About | FAQ | Privacy | Awards | Contact
Comments to the webmaster are welcome.
Copyright 2006 Sourcefiles.org All rights reserved.