Leptonica 1.68
C Image Processing Library

psio1.c File Reference

High level PostScript device driver for wrapping sets of images in PostScript. More...

#include <string.h>
#include "allheaders.h"

Go to the source code of this file.

Functions

l_int32 convertFilesToPS (const char *dirin, const char *substr, l_int32 res, const char *fileout)
l_int32 sarrayConvertFilesToPS (SARRAY *sa, l_int32 res, const char *fileout)
l_int32 convertFilesFittedToPS (const char *dirin, const char *substr, l_float32 xpts, l_float32 ypts, const char *fileout)
l_int32 sarrayConvertFilesFittedToPS (SARRAY *sa, l_float32 xpts, l_float32 ypts, const char *fileout)
l_int32 writeImageCompressedToPSFile (const char *filein, const char *fileout, l_int32 res, l_int32 *pfirstfile, l_int32 *pindex)
l_int32 convertSegmentedPagesToPS (const char *pagedir, const char *pagestr, const char *maskdir, const char *maskstr, l_int32 numpre, l_int32 numpost, l_int32 maxnum, l_float32 textscale, l_float32 imagescale, l_int32 threshold, const char *fileout)
l_int32 pixWriteSegmentedPageToPS (PIX *pixs, PIX *pixm, l_float32 textscale, l_float32 imagescale, l_int32 threshold, l_int32 pageno, const char *fileout)
l_int32 pixWriteMixedToPS (PIX *pixb, PIX *pixc, l_float32 scale, l_int32 pageno, const char *fileout)
l_int32 convertToPSEmbed (const char *filein, const char *fileout, l_int32 level)
l_int32 pixaWriteCompressedToPS (PIXA *pixa, const char *fileout, l_int32 res, l_int32 level)

Detailed Description

High level PostScript device driver for wrapping sets of images in PostScript.

  |=============================================================|
  |                         Important note                      |
  |=============================================================|
  | Some of these functions require libtiff, libjpeg and libz.  |
  | If you do not have these libraries, you must set            |
  |     #define  USE_PSIO     0                                 |
  | in environ.h.  This will link psio1stub.c                   |
  |=============================================================|

   This is a PostScript "device driver" for wrapping images
   in PostScript.  The images can be rendered by a PostScript
   interpreter for viewing, using evince or gv.  They can also be
   rasterized for printing, using gs or an embedded interpreter
   in a PostScript printer.  And they can be converted to a pdf
   using gs (ps2pdf).

   Convert specified files to PS
        l_int32          convertFilesToPS()
        l_int32          sarrayConvertFilesToPS()
        l_int32          convertFilesFittedToPS()
        l_int32          sarrayConvertFilesFittedToPS()
        l_int32          writeImageCompressedToPSFile()

   Convert mixed text/image files to PS
        l_int32          convertSegmentedPagesToPS()
        l_int32          pixWriteSegmentedPageToPS()
        l_int32          pixWriteMixedToPS()

   Convert any image file to PS for embedding
        l_int32          convertToPSEmbed()

   Write all images in a pixa out to PS
        l_int32          pixaWriteCompressedToPS()

These PostScript converters are used in three different ways.

(1) For embedding a PS file in a program like TeX.
    convertToPSEmbed() handles this for levels 1, 2 and 3 output,
    and prog/converttops wraps this in an executable.
    converttops is a generalization of Thomas Merz's jpeg2ps wrapper,
    in that it works for all types (formats, depth, colormap)
    of input images and gives PS output in one of these formats
 level 1 (uncompressed)
 level 2 (compressed ccittg4 or dct)
 level 3 (compressed flate)

(2) For composing a set of pages with any number of images
    painted on them, in either level 2 or level 3 formats.

(3) For printing a page image or a set of page images, at a
    resolution that optimally fills the page, using
    convertFilesFittedToPS().

The top-level calls of utilities in category 2, which can compose
multiple images on a page, and which generate a PostScript file for
printing or display (e.g., conversion to pdf), are:
    convertFilesToPS()
    convertFilesFittedToPS()
    convertSegmentedPagesToPS()

All images are output with page numbers.  Bounding box hints are
more subtle.  They must be included for embeding images in
TeX, for example, and the low-level writers include bounding
box hints by default.  However, these hints should not be included for
multi-page PostScript that is composed of a sequence of images;
consequently, they are not written when calling higher level
functions such as convertFilesToPS(), convertFilesFittedToPS()
and convertSegmentedPagesToPS().  The function l_psWriteBoundingBox()
sets a flag to give low-level control over this.

Definition in file psio1.c.


Function Documentation

l_int32 convertFilesToPS ( const char *  dirin,
const char *  substr,
l_int32  res,
const char *  fileout 
)
l_int32 sarrayConvertFilesToPS ( SARRAY sa,
l_int32  res,
const char *  fileout 
)
l_int32 convertFilesFittedToPS ( const char *  dirin,
const char *  substr,
l_float32  xpts,
l_float32  ypts,
const char *  fileout 
)
l_int32 sarrayConvertFilesFittedToPS ( SARRAY sa,
l_float32  xpts,
l_float32  ypts,
const char *  fileout 
)
l_int32 writeImageCompressedToPSFile ( const char *  filein,
const char *  fileout,
l_int32  res,
l_int32 pfirstfile,
l_int32 pindex 
)
l_int32 convertSegmentedPagesToPS ( const char *  pagedir,
const char *  pagestr,
const char *  maskdir,
const char *  maskstr,
l_int32  numpre,
l_int32  numpost,
l_int32  maxnum,
l_float32  textscale,
l_float32  imagescale,
l_int32  threshold,
const char *  fileout 
)
l_int32 pixWriteSegmentedPageToPS ( PIX pixs,
PIX pixm,
l_float32  textscale,
l_float32  imagescale,
l_int32  threshold,
l_int32  pageno,
const char *  fileout 
)
l_int32 pixWriteMixedToPS ( PIX pixb,
PIX pixc,
l_float32  scale,
l_int32  pageno,
const char *  fileout 
)
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines