src/pdfio.c
l_int32
convertFilesToPdf(const char  *dirname,
                  const char  *substr,
                  l_int32      res,
                  l_float32    scalefactor,
                  l_int32      quality,
                  const char  *title,
                  const char  *fileout)
{
l_int32  ret;
SARRAY  *sa;

    PROCNAME("convertFilesToPdf");

    if (!dirname)
        return ERROR_INT("dirname not defined", procName, 1);
    if (!fileout)
        return ERROR_INT("fileout not defined", procName, 1);

    if ((sa = getSortedPathnamesInDirectory(dirname, substr, 0, 0)) == NULL)
        return ERROR_INT("sa not made", procName, 1);
    ret = saConvertFilesToPdf(sa, res, scalefactor, quality, title, fileout);
    sarrayDestroy(&sa);
    return ret;
}
/*!
 *  convertFilesToPdf()
 *
 *      Input:  directory name (containing images)
 *              substr (<optional> substring filter on filenames; can be NULL)
 *              res (input resolution of all images)
 *              scalefactor (scaling factor applied to each image)
 *              quality (used for JPEG only; 0 for default (75))
 *              title (<optional> pdf title; if null, taken from the first
 *                     image filename)
 *              fileout (pdf file of all images)
 *      Return: 0 if OK, 1 on error
 *
 *  Notes:
 *      (1) If @substr is not NULL, only image filenames that contain
 *          the substring can be used.  If @substr == NULL, all files
 *          in the directory are used.
 *      (2) The files in the directory, after optional filtering by
 *          the substring, are lexically sorted in increasing order
 *          before concatenation.
 *      (3) The images are encoded with G4 if 1 bpp; JPEG if 8 bpp without
 *          colormap and many colors, or 32 bpp; FLATE for anything else.
 */


(1) If @substr is not NULL, only image filenames that contain
the substring can be used.  If @substr == NULL, all files
in the directory are used.
(2) The files in the directory, after optional filtering by
the substring, are lexically sorted in increasing order
before concatenation.
(3) The images are encoded with G4 if 1 bpp; JPEG if 8 bpp without
colormap and many colors, or 32 bpp; FLATE for anything else.
( 1 ) If @substr is not NULL only image filenames that contain the substring can be used . If @substr == NULL all files in the directory are used . ( 2 ) The files in the directory after optional filtering by the substring are lexically sorted in increasing order before concatenation . ( 3 ) The images are encoded with G4 if 1 bpp ; JPEG if 8 bpp without colormap and many colors or 32 bpp ; FLATE for anything else .
l_int32
convertFilesToPdf(const char  *dirname,
                  const char  *substr,
                  l_int32      res,
                  l_float32    scalefactor,
                  l_int32      quality,
                  const char  *title,
                  const char  *fileout)
{
l_int32  ret;
SARRAY  *sa;
    PROCNAME("convertFilesToPdf");
    if (!dirname)
        return ERROR_INT("dirname not defined", procName, 1);
    if (!fileout)
        return ERROR_INT("fileout not defined", procName, 1);
    if ((sa = getSortedPathnamesInDirectory(dirname, substr, 0, 0)) == NULL)
        return ERROR_INT("sa not made", procName, 1);
    ret = saConvertFilesToPdf(sa, res, scalefactor, quality, title, fileout);
    sarrayDestroy(&sa);
    return ret;
}
l_int32 convertFilesToPdf ( const char * dirname , const char * substr , l_int32 res , l_float32 scalefactor , l_int32 quality , const char * title , const char * fileout ) { l_int32 ret ; SARRAY * sa ; PROCNAME ( " " ) ; if ( ! dirname ) return ERROR_INT ( " " , procName , 1 ) ; if ( ! fileout ) return ERROR_INT ( " " , procName , 1 ) ; if ( ( sa = getSortedPathnamesInDirectory ( dirname , substr , 0 , 0 ) ) == NULL ) return ERROR_INT ( " " , procName , 1 ) ; ret = saConvertFilesToPdf ( sa , res , scalefactor , quality , title , fileout ) ; sarrayDestroy ( & sa ) ; return ret ; }
convertFilesToPdf()
      Input:  directory name (containing images)
              substr (<optional> substring filter on filenames; can be NULL)
              res (input resolution of all images)
              scalefactor (scaling factor applied to each image)
              quality (used for JPEG only; 0 for default (75))
              title (<optional> pdf title; if null, taken from the first
                     image filename)
              fileout (pdf file of all images)
      Return: 0 if OK, 1 on error
convertFilesToPdf () Input : directory name ( containing images ) substr ( <optional > substring filter on filenames ; can be NULL ) res ( input resolution of all images ) scalefactor ( scaling factor applied to each image ) quality ( used for JPEG only ; 0 for default ( 75 )) title ( <optional > pdf title ; if null taken from the first image filename ) fileout ( pdf file of all images ) Return : 0 if OK 1 on error