src/psio1.c
l_int32
convertFilesFittedToPS(const char  *dirin,
                       const char  *substr,
                       l_float32    xpts,
                       l_float32    ypts,
                       const char  *fileout)
{
SARRAY  *sa;

    PROCNAME("convertFilesFittedToPS");

    if (!dirin)
        return ERROR_INT("dirin not defined", procName, 1);
    if (!fileout)
        return ERROR_INT("fileout not defined", procName, 1);
    if (xpts <= 0.0) {
        L_INFO("setting xpts to 612.0 ppi", procName);
        xpts = 612.0;
    }
    if (ypts <= 0.0) {
        L_INFO("setting ypts to 792.0 ppi", procName);
        ypts = 792.0;
    }
    if (xpts < 100.0 || xpts > 2000.0 || ypts < 100.0 || ypts > 2000.0)
        L_WARNING("xpts,ypts are typically in the range 500-800", procName);

        /* Get all filtered and sorted full pathnames. */
    sa = getSortedPathnamesInDirectory(dirin, substr, 0, 0);

        /* Generate the PS file.  Don't use bounding boxes. */
    l_psWriteBoundingBox(FALSE);
    sarrayConvertFilesFittedToPS(sa, xpts, ypts, fileout);
    l_psWriteBoundingBox(TRUE);
    sarrayDestroy(&sa);
    return 0;
}
/*
 *  convertFilesFittedToPS()
 *
 *      Input:  dirin (input directory)
 *              substr (<optional> substring filter on filenames; can be NULL)
 *              xpts, ypts (desired size in printer points; use 0 for default)
 *              fileout (output ps file)
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) This generates a PS file for all files in a specified directory
 *          that contain the substr pattern to be matched.
 *      (2) Each image is written to a separate page in the output PS file.
 *      (3) All images are written compressed:
 *              * if tiffg4  -->  use ccittg4
 *              * if jpeg    -->  use dct
 *              * all others -->  use flate
 *          If the image is jpeg or tiffg4, we use the existing compressed
 *          strings for the encoding; otherwise, we read the image into
 *          a pix and flate-encode the pieces.
 *      (4) The resolution is internally determined such that the images
 *          are rendered, in at least one direction, at 100% of the given
 *          size in printer points.  Use 0.0 for xpts or ypts to get
 *          the default value, which is 612.0 or 792.0, rsp.
 *      (5) The size of the PostScript file is independent of the resolution,
 *          because the entire file is encoded.  The @xpts and @ypts
 *          parameter tells the PS decomposer how to render the page.
 */
convertFilesFittedToPS()
Input:  dirin (input directory)
substr ( substring filter on filenames; can be NULL)
xpts, ypts (desired size in printer points; use 0 for default)
fileout (output ps file)
Return: 0 if OK, 1 on error

(1) This generates a PS file for all files in a specified directory
that contain the substr pattern to be matched.
(2) Each image is written to a separate page in the output PS file.
convertFilesFittedToPS () Input : dirin ( input directory ) substr ( substring filter on filenames ; can be NULL ) xpts ypts ( desired size in printer points ; use 0 for default ) fileout ( output ps file ) Return : 0 if OK 1 on error ( 1 ) This generates a PS file for all files in a specified directory that contain the substr pattern to be matched . ( 2 ) Each image is written to a separate page in the output PS file .
l_int32
convertFilesFittedToPS(const char  *dirin,
                       const char  *substr,
                       l_float32    xpts,
                       l_float32    ypts,
                       const char  *fileout)
{
SARRAY  *sa;
    PROCNAME("convertFilesFittedToPS");
    if (!dirin)
        return ERROR_INT("dirin not defined", procName, 1);
    if (!fileout)
        return ERROR_INT("fileout not defined", procName, 1);
    if (xpts <= 0.0) {
        L_INFO("setting xpts to 612.0 ppi", procName);
        xpts = 612.0;
    }
    if (ypts <= 0.0) {
        L_INFO("setting ypts to 792.0 ppi", procName);
        ypts = 792.0;
    }
    if (xpts < 100.0 || xpts > 2000.0 || ypts < 100.0 || ypts > 2000.0)
        L_WARNING("xpts,ypts are typically in the range 500-800", procName);
    sa = getSortedPathnamesInDirectory(dirin, substr, 0, 0);
    l_psWriteBoundingBox(FALSE);
    sarrayConvertFilesFittedToPS(sa, xpts, ypts, fileout);
    l_psWriteBoundingBox(TRUE);
    sarrayDestroy(&sa);
    return 0;
}
l_int32 convertFilesFittedToPS ( const char * dirin , const char * substr , l_float32 xpts , l_float32 ypts , const char * fileout ) { SARRAY * sa ; PROCNAME ( " " ) ; if ( ! dirin ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! fileout ) return ERROR_INT ( " " , procName , 1 ) ; if ( xpts <= 0.0 ) { L_INFO ( " " , procName ) ; xpts = 612.0 ; } if ( ypts <= 0.0 ) { L_INFO ( " " , procName ) ; ypts = 792.0 ; } if ( xpts < 100.0 || xpts > 2000.0 || ypts < 100.0 || ypts > 2000.0 ) L_WARNING ( " " , procName ) ; sa = getSortedPathnamesInDirectory ( dirin , substr , 0 , 0 ) ; l_psWriteBoundingBox ( FALSE ) ; sarrayConvertFilesFittedToPS ( sa , xpts , ypts , fileout ) ; l_psWriteBoundingBox ( TRUE ) ; sarrayDestroy ( & sa ) ; return 0 ; }
convertFilesFittedToPS()
      Input:  dirin (input directory)
              substr (<optional> substring filter on filenames; can be NULL)
              xpts, ypts (desired size in printer points; use 0 for default)
              fileout (output ps file)
      Return: 0 if OK, 1 on error
convertFilesFittedToPS () Input : dirin ( input directory ) substr ( <optional > substring filter on filenames ; can be NULL ) xpts ypts ( desired size in printer points ; use 0 for default ) fileout ( output ps file ) Return : 0 if OK 1 on error
/* Get all filtered and sorted full pathnames. */ /* Generate the PS file.  Don't use bounding boxes. */