Skip to content

Commit d90442d

Browse files
authored
Merge pull request #789 from shutter-project/fix-788
Fix PDF and PS export, #788
2 parents 45d0fe1 + 5bdc905 commit d90442d

File tree

1 file changed

+9
-2
lines changed
  • share/shutter/resources/modules/Shutter/Pixbuf

1 file changed

+9
-2
lines changed

share/shutter/resources/modules/Shutter/Pixbuf/Save.pm

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,10 +80,17 @@ sub set_quality_setting {
8080
sub save_pdf_ps_svg {
8181
my $self = shift;
8282
my $filename = shift;
83+
my $filetype = shift;
8384
my $pixbuf = shift;
85+
86+
my $class = {
87+
pdf => 'Cairo::PdfSurface',
88+
ps => 'Cairo::PsSurface',
89+
svg => 'Cairo::SvgSurface',
90+
}->{$filetype};
8491

8592
#0.8? => 72 / 90 dpi
86-
my $surface = Cairo::SvgSurface->create($filename, $pixbuf->get_width * 0.8, $pixbuf->get_height * 0.8);
93+
my $surface = $class->create($filename, $pixbuf->get_width * 0.8, $pixbuf->get_height * 0.8);
8794
my $cr = Cairo::Context->create($surface);
8895
$cr->scale(0.8, 0.8);
8996
Gtk3::Gdk::cairo_set_source_pixbuf($cr, $pixbuf, 0, 0);
@@ -175,7 +182,7 @@ sub save_pixbuf_to_file {
175182

176183
} elsif ($filetype eq 'pdf' || $filetype eq 'ps' || $filetype eq 'svg') {
177184

178-
$self->save_pdf_ps_svg($filename, $pixbuf);
185+
$self->save_pdf_ps_svg($filename, $filetype, $pixbuf);
179186

180187
print "Saving file $filename, $filetype\n" if $self->{_common}->get_debug;
181188

0 commit comments

Comments
 (0)