add password fielf to pdfiumload
and docs
This commit is contained in:
parent
cb78b1b9fb
commit
d9c00eb5ca
@ -2583,6 +2583,7 @@ vips_jxlsave_target( VipsImage *in, VipsTarget *target, ... )
|
||||
* * @dpi: %gdouble, render at this DPI
|
||||
* * @scale: %gdouble, scale render by this factor
|
||||
* * @background: #VipsArrayDouble background colour
|
||||
* * @password: %gchararray background colour
|
||||
*
|
||||
* Render a PDF file into a VIPS image.
|
||||
*
|
||||
@ -2603,6 +2604,8 @@ vips_jxlsave_target( VipsImage *in, VipsTarget *target, ... )
|
||||
* Use @background to set the background RGBA colour. The default is 255
|
||||
* (solid white), use eg. 0 for a transparent background.
|
||||
*
|
||||
* Use @password to supply a decryption password.
|
||||
*
|
||||
* The operation fills a number of header fields with metadata, for example
|
||||
* "pdf-author". They may be useful.
|
||||
*
|
||||
|
@ -12,6 +12,8 @@
|
||||
* - have a lock just for pdfium [DarthSim]
|
||||
* - update for current pdfium
|
||||
* - add _source input
|
||||
* 28/1/22
|
||||
* - add password
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -130,6 +132,10 @@ typedef struct _VipsForeignLoadPdf {
|
||||
*/
|
||||
VipsArrayDouble *background;
|
||||
|
||||
/* Decrypt with this.
|
||||
*/
|
||||
const char *password;
|
||||
|
||||
FPDF_FILEACCESS file_access;
|
||||
FPDF_DOCUMENT doc;
|
||||
FPDF_PAGE page;
|
||||
@ -281,7 +287,7 @@ vips_foreign_load_pdf_build( VipsObject *object )
|
||||
g_mutex_lock( vips_pdfium_mutex );
|
||||
|
||||
if( !(pdf->doc = FPDF_LoadCustomDocument( &pdf->file_access,
|
||||
NULL )) ) {
|
||||
pdf->password )) ) {
|
||||
g_mutex_unlock( vips_pdfium_mutex );
|
||||
vips_pdfium_error();
|
||||
vips_error( "pdfload",
|
||||
@ -693,6 +699,13 @@ vips_foreign_load_pdf_class_init( VipsForeignLoadPdfClass *class )
|
||||
G_STRUCT_OFFSET( VipsForeignLoadPdf, background ),
|
||||
VIPS_TYPE_ARRAY_DOUBLE );
|
||||
|
||||
VIPS_ARG_STRING( class, "password", 25,
|
||||
_( "Password" ),
|
||||
_( "Decrypt with this password" ),
|
||||
VIPS_ARGUMENT_OPTIONAL_INPUT,
|
||||
G_STRUCT_OFFSET( VipsForeignLoadPdf, password ),
|
||||
NULL );
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -20,6 +20,8 @@
|
||||
* - allow dpi and scale to both be set [le0daniel]
|
||||
* 21/4/21 kleisauke
|
||||
* - include GObject part from pdfload.c
|
||||
* 28/1/22
|
||||
* - add password
|
||||
*/
|
||||
|
||||
/*
|
||||
|
Loading…
x
Reference in New Issue
Block a user