! * \brief pixcompFastConvertToPdfData() * * \param[in] pixc containing images all at the same resolution * \param[in] title [optional] pdf title * \param[out] pdata output pdf data (of all images * \param[out] pnbytes size of output pdf data * \return 0 if OK, 1 on error * * * Notes: * (1) This generates the pdf without transcoding. * (2) It assumes all
| 2198 | * </pre> |
| 2199 | */ |
| 2200 | static l_int32 |
| 2201 | pixcompFastConvertToPdfData(PIXC *pixc, |
| 2202 | const char *title, |
| 2203 | l_uint8 **pdata, |
| 2204 | size_t *pnbytes) |
| 2205 | { |
| 2206 | l_uint8 *data; |
| 2207 | L_COMP_DATA *cid; |
| 2208 | |
| 2209 | PROCNAME("pixacompFastConvertToPdfData"); |
| 2210 | |
| 2211 | if (!pdata) |
| 2212 | return ERROR_INT("&data not defined", procName, 1); |
| 2213 | *pdata = NULL; |
| 2214 | if (!pnbytes) |
| 2215 | return ERROR_INT("&nbytes not defined", procName, 1); |
| 2216 | *pnbytes = 0; |
| 2217 | if (!pixc) |
| 2218 | return ERROR_INT("pixc not defined", procName, 1); |
| 2219 | |
| 2220 | /* Make a copy of the data */ |
| 2221 | data = l_binaryCopy(pixc->data, pixc->size); |
| 2222 | cid = l_generateJpegDataMem(data, pixc->size, 0); |
| 2223 | |
| 2224 | /* Note: cid is destroyed, along with data, by this function */ |
| 2225 | return cidConvertToPdfData(cid, title, pdata, pnbytes); |
| 2226 | } |
| 2227 | |
| 2228 | |
| 2229 | /*--------------------------------------------------------------------* |
no test coverage detected