Help language development. Donate to The Perl Foundation

PDF::Class cpan:WARRINGD last updated on 2020-08-11

use v6;
use Test;
use PDF::Class;
use PDF::Page;

my PDF::Class $pdf .= open('t/update.pdf');
my $new-page = $pdf.Pages.add-page;
$new-page.gfx.say( 'New Last Page!!' );
# ensure consistant document ID generation
ok $pdf.update(:!info), 'update';

$pdf .= open('t/update.pdf');
is $, 2, 'pdf now has two pages';

ok $'tmp/update-resaved.json', :!info), 'save-as json';

$pdf .= open('tmp/update-resaved.json');
is $pdf<Info><Author>, 't/helloworld.t', '$pdf<Info><Author>';
ok my PDF::Page $p2 = $, 'pdf reload from json';

my PDF::Page $p2-again;
lives-ok {$p2-again = $pdf.delete-page(2)}, 'delete-page lives';
ok $p2 === $p2-again, 'deleted page returned';
is $, 1, 'pages after deletion';