[Remind-Fans] Remind 3.4.0 Beta 2 - with correct download links this time
Dianne Skoll
dianne at skoll.ca
Thu Feb 3 17:28:30 EST 2022
On Thu, 03 Feb 2022 17:08:31 -0500
Hymie! via Remind-fans <remind-fans at lists.skoll.ca> wrote:
> So I just insatlled the Cairo and Pango modules from CPAN, but I'm
> having some issues:
> Can't locate object method "set_metadata" via package
> "Cairo::PdfSurface" at ./rem2pdf/bin/rem2pdf line 189. Can't locate
> object method "set_page_label" via package "Cairo::PdfSurface" at
> rem2pdf/lib/Remind/PDF.pm line 704.
I suspect your version of libcaro is too old. The POD for those
methods reads:
=item $surface->set_metadata($name, $value) [1.16]
=item $surface->set_page_label($label) [1.16]
which indicates they're only available in Cairo version 1.16.
It's probably safe to wrap them in an eval { ... }, I guess... please
try the patch below, or pull from git master.
Regards,
Dianne.
--- a/rem2pdf/bin/rem2pdf.in
+++ b/rem2pdf/bin/rem2pdf.in
@@ -186,10 +186,11 @@ my $errored_out = 0;
my $surface = Cairo::PdfSurface->create_for_stream(sub { print $_[1] unless $errored_out; }, undef,
$settings->{width}, $settings->{height});
-$surface->set_metadata('title', 'Calendar');
-$surface->set_metadata('author', 'Remind (https://dianne.skoll.ca/projects/remind/)');
-$surface->set_metadata('creator', 'rem2pdf (https://dianne.skoll.ca/projects/remind/)');
-$surface->set_metadata('subject', 'Calendar');
+# set_metadata not available in older versions of Cairo
+eval { $surface->set_metadata('title', 'Calendar'); };
+eval { $surface->set_metadata('author', 'Remind (https://dianne.skoll.ca/projects/remind/)'); };
+eval { $surface->set_metadata('creator', 'rem2pdf (https://dianne.skoll.ca/projects/remind/)'); };
+eval { $surface->set_metadata('subject', 'Calendar'); };
my $cr = Cairo::Context->create($surface);
$cr->set_line_width($settings->{line_thickness});
diff --git a/rem2pdf/lib/Remind/PDF.pm b/rem2pdf/lib/Remind/PDF.pm
index b790314..8a35197 100644
--- a/rem2pdf/lib/Remind/PDF.pm
+++ b/rem2pdf/lib/Remind/PDF.pm
@@ -701,7 +701,8 @@ sub draw_title
my ($self, $cr, $settings) = @_;
my $title = $self->{monthname} . ' ' . $self->{year};
- $cr->get_target()->set_page_label($title);
+ # set_page_label not available in older versions of Cairo
+ eval { $cr->get_target()->set_page_label($title); };
my $layout = Pango::Cairo::create_layout($cr);
$layout->set_text(Encode::decode('UTF-8', $title));
my $desc = Pango::FontDescription->from_string($settings->{title_font} . ' ' . $settings->{title_size} . 'px');
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://dianne.skoll.ca/pipermail/remind-fans/attachments/20220203/e4d312f9/attachment.sig>
More information about the Remind-fans
mailing list