Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/PDF/WebKit.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<new|/Constructor> method for the standard default options.
Expand Down
7 changes: 7 additions & 0 deletions t/pdf-webkit.t
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down