src/pdfio.c
l_int32
saConvertFilesToPdf(SARRAY      *sa,
                    l_int32      res,
                    l_float32    scalefactor,
                    l_int32      quality,
                    const char  *title,
                    const char  *fileout)
{
l_uint8  *data;
l_int32   ret;
size_t    nbytes;

    PROCNAME("saConvertFilesToPdf");

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

    ret = saConvertFilesToPdfData(sa, res, scalefactor, quality, title,
                                  &data, &nbytes);
    if (ret) {
        if (data) FREE(data);
        return ERROR_INT("pdf data not made", procName, 1);
    }

    ret = l_binaryWrite(fileout, "w", data, nbytes);
    FREE(data);
    if (ret)
        L_ERROR("pdf data not written to file", procName);
    return ret;
}
/*!
 *  saConvertFilesToPdf()
 *
 *      Input:  sarray (of pathnames for images)
 *              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) 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) 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 ) 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
saConvertFilesToPdf(SARRAY      *sa,
                    l_int32      res,
                    l_float32    scalefactor,
                    l_int32      quality,
                    const char  *title,
                    const char  *fileout)
{
l_uint8  *data;
l_int32   ret;
size_t    nbytes;
    PROCNAME("saConvertFilesToPdf");
    if (!sa)
        return ERROR_INT("sa not defined", procName, 1);
    ret = saConvertFilesToPdfData(sa, res, scalefactor, quality, title,
                                  &data, &nbytes);
    if (ret) {
        if (data) FREE(data);
        return ERROR_INT("pdf data not made", procName, 1);
    }
    ret = l_binaryWrite(fileout, "w", data, nbytes);
    FREE(data);
    if (ret)
        L_ERROR("pdf data not written to file", procName);
    return ret;
}
l_int32 saConvertFilesToPdf ( SARRAY * sa , l_int32 res , l_float32 scalefactor , l_int32 quality , const char * title , const char * fileout ) { l_uint8 * data ; l_int32 ret ; size_t nbytes ; PROCNAME ( " " ) ; if ( ! sa ) return ERROR_INT ( " " , procName , 1 ) ; ret = saConvertFilesToPdfData ( sa , res , scalefactor , quality , title , & data , & nbytes ) ; if ( ret ) { if ( data ) FREE ( data ) ; return ERROR_INT ( " " , procName , 1 ) ; } ret = l_binaryWrite ( fileout , " " , data , nbytes ) ; FREE ( data ) ; if ( ret ) L_ERROR ( " " , procName ) ; return ret ; }
saConvertFilesToPdf()
      Input:  sarray (of pathnames for images)
              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
saConvertFilesToPdf () Input : sarray ( of pathnames for images ) 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