diff --git a/lib/PDF/WebKit.pm b/lib/PDF/WebKit.pm index 5e83e5b..a62112d 100644 --- a/lib/PDF/WebKit.pm +++ b/lib/PDF/WebKit.pm @@ -194,7 +194,7 @@ sub _prepare_options { push @args, $name; } else { - push @args, $name, $val; + push @args, $name, (ref($val) eq 'ARRAY') ? @$val : $val; } } return @args; @@ -271,6 +271,9 @@ C<< PDF::WebKit->configure >> class method: $_->meta_tag_prefix('my-prefix-'); $_->default_options->{'--orientation'} = 'Portrait'; + + # Some options expects multiple values + $_->default_options->{'--custom-header'} = ['DNT', '1']; }); See the L method for the standard default options. diff --git a/t/pdf-webkit.t b/t/pdf-webkit.t index 17b3230..d45266d 100644 --- a/t/pdf-webkit.t +++ b/t/pdf-webkit.t @@ -106,6 +106,13 @@ describe "PDF::WebKit" => sub { like( $command[index_of('--no-collate',@command) + 1], qr/^-/ ); }; + it "should accept multiple values" => sub { + my $pdfkit = PDF::WebKit->new(\'html', '--custom-header' => [ 'X-Foo', 'bar bas' ] ); + my @command = $pdfkit->command; + is( $command[index_of('--custom-header',@command) + 1], 'X-Foo' ); + is( $command[index_of('--custom-header',@command) + 2], 'bar bas' ); + }; + it "should encapsulate string arguments in quotes" => sub { my $pdfkit = PDF::WebKit->new(\'html', header_center => "foo [page]"); my @command = $pdfkit->command;