diff --git a/ChangeLog b/ChangeLog index 2a8d8896..55cf66ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,7 +2,7 @@ - add vips_reduce*() ... a fast path for bicubic downsize - vips_resize() and vips_similarity use it when they can - bicubic is better on 32-bit int images -- add popplerload +- add popplerload for PDF rendering 27/1/16 started 8.2.3 - fix a crash with SPARC byte-order labq vips images diff --git a/libvips/foreign/foreign.c b/libvips/foreign/foreign.c index 854d0354..b533a290 100644 --- a/libvips/foreign/foreign.c +++ b/libvips/foreign/foreign.c @@ -2846,3 +2846,40 @@ vips_matload( const char *filename, VipsImage **out, ... ) return( result ); } + +/** + * vips_popplerload: + * @filename: file to load + * @out: output image + * @...: %NULL-terminated list of optional named arguments + * + * Optional arguments: + * + * @page: %gint, load this page, numbered from zero + * @dpi: %gdouble, render at this DPI + * + * Render a PDF file into a VIPS image. + * + * Use @page to select a page to render, numbering from zero. + * + * Use @dpi to set the rendering resolution. The default is 72. + * + * This function only reads the image header and does not render any pixel + * data. Rendering only occurs when pixels are accessed. + * + * See also: vips_image_new_from_file(). + * + * Returns: 0 on success, -1 on error. + */ +int +vips_popplerload( const char *filename, VipsImage **out, ... ) +{ + va_list ap; + int result; + + va_start( ap, out ); + result = vips_call_split( "popplerload", ap, filename, out ); + va_end( ap ); + + return( result ); +} diff --git a/libvips/include/vips/foreign.h b/libvips/include/vips/foreign.h index 4ba61e5f..a2e6acb4 100644 --- a/libvips/include/vips/foreign.h +++ b/libvips/include/vips/foreign.h @@ -490,6 +490,9 @@ int vips_radload( const char *filename, VipsImage **out, ... ) int vips_radsave( VipsImage *in, const char *filename, ... ) __attribute__((sentinel)); +int vips_popplerload( const char *filename, VipsImage **out, ... ) + __attribute__((sentinel)); + /** * VipsForeignDzLayout: * @VIPS_FOREIGN_DZ_LAYOUT_DZ: use DeepZoom directory layout