Add warning if someone attempts to create a multi-page SVG calendar.

This commit is contained in:
Dianne Skoll
2024-07-05 16:57:18 -04:00
parent d9ae417e01
commit e2185e773a
2 changed files with 19 additions and 1 deletions

View File

@@ -207,6 +207,7 @@ eval { $surface->set_metadata('subject', 'Calendar'); };
my $cr = Cairo::Context->create($surface);
$cr->set_line_width($settings->{line_thickness});
my $warned = 0;
while(1) {
my ($obj, $err) = Remind::PDF->create_from_stream(*STDIN,
{color => 1,
@@ -223,8 +224,15 @@ while(1) {
}
last;
}
$done_one = 1;
if ($settings->{svg} && $done_one) {
if (!$warned) {
print STDERR "WARNING: --svg can only output one page; ignoring subsequent\nmonths in a multi-month calendar.\n";
$warned = 1;
}
next;
}
$obj->render($cr, $settings);
$done_one = 1;
}
$surface->finish();

View File

@@ -1008,7 +1008,17 @@ as were read from the C<remind -ppp> stream
sub render
{
my ($self, $cr, $settings) = @_;
my $done = 0;
my $warned = 0;
foreach my $e (@{$self->{entries}}) {
if ($settings->{svg} && $done) {
if (!$warned) {
print STDERR "WARNING: --svg can only output one page; ignoring subsequent\nmonths in a multi-month calendar.\n";
$warned = 1;
}
next;
}
$done = 1;
$e->render($cr, $settings);
}
}