rpms/gscan2pdf/devel gscan2pdf-fix-paper-size.patch, NONE, 1.1 gscan2pdf.spec, 1.9, 1.10

Bernard Johnson (bjohnson) fedora-extras-commits at redhat.com
Fri Jun 15 03:57:43 UTC 2007


Author: bjohnson

Update of /cvs/pkgs/rpms/gscan2pdf/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv15617/devel

Modified Files:
	gscan2pdf.spec 
Added Files:
	gscan2pdf-fix-paper-size.patch 
Log Message:
fix paper size in output pdf


gscan2pdf-fix-paper-size.patch:

--- NEW FILE gscan2pdf-fix-paper-size.patch ---
--- a/bin/gscan2pdf	Wed Jun 13 08:13:10 2007 +0200
+++ b/bin/gscan2pdf	Wed Jun 13 13:21:59 2007 +0200
@@ -453,7 +453,8 @@ Gtk2::Ex::Simple::List -> add_column_typ
 $slist = Gtk2::Ex::Simple::List -> new('#' => 'int',
                                        $d->get('Thumbnails') => 'pixbuf',
                                        'Filename' => 'hstring',
-                                       'Buffer' => 'hstring');
+                                       'Buffer' => 'hstring',
+                                       'Resolution' => 'hstring');
 
 # Callback for dropped signal.
 $slist -> signal_connect('drag_drop' => sub {
@@ -1092,7 +1093,7 @@ sub convert_to_tiff {
 
 # Write the tif
  $image->Write(units => 'PixelsPerInch',
-               density => $density.'x'.$density,
+               density => $density,
                filename => "$filename.tif");
  return "$filename.tif";
 }
@@ -1153,21 +1154,21 @@ sub import {
 
 # Import each image
     my @images = <x-???.???>;
-    import_scan($_, undef, 'Portable anymap', TRUE) foreach (@images);
+    import_scan($_, undef, 'Portable anymap', undef, TRUE) foreach (@images);
    }
    elsif ($format eq 'Tagged Image File Format') {
 
 # Split the tiff into its pages and import them individually
     system("tiffsplit \"$filename\"");
     my @pages = <x???.tif>;
-    import_scan($_, undef, $format, TRUE) foreach (@pages);
+    import_scan($_, undef, $format, undef, TRUE) foreach (@pages);
    }
    elsif ($format =~ /(Portable anymap)|(Portable Network Graphics)|(Joint Photographic Experts Group JFIF format)|(CompuServe graphics interchange format)/) {
     import_scan($filename, undef, $format);
    }
    else {
     my $tiff = convert_to_tiff($filename);
-    import_scan($tiff, undef, 'Tagged Image File Format', TRUE);
+    import_scan($tiff, undef, 'Tagged Image File Format', undef, TRUE);
    }
 
   }
@@ -1497,7 +1498,8 @@ sub create_PDF {
 # Get the size and resolution
    my $w = $image->Get('width');
    my $h = $image->Get('height');
-   my $resolution = $image->Get('x-resolution');
+   my $resolution = $slist -> {data}[$_][4];
+   $resolution = $image->Get('x-resolution') if (! defined($resolution));
 
    $page->mediabox($w*72/$resolution, $h*72/$resolution);
 
@@ -2497,7 +2499,8 @@ sub scanimage {
 
 # If the scan can't be loaded then blow the scanning dialog away and
 # show an error
-      if (! import_scan ("out$1.pnm", $1*$step+$offset, 'Portable anymap', TRUE, $unpaper, $ocr)) {
+      if (! import_scan ("out$1.pnm", $1*$step+$offset, 'Portable anymap',
+                                  $SETTING{resolution}, TRUE, $unpaper, $ocr)) {
        $dialog -> destroy;
        $dialog = Gtk2::MessageDialog -> new ($windows, 'destroy-with-parent',
                          'error', 'close', $d->get('Unable to load image'));
@@ -2641,7 +2644,8 @@ sub scanadf {
 
 # If the scan can't be loaded then blow the scanning dialog away and
 # show an error
-      if (! import_scan ("out$1.pnm", $1*$step+$offset, 'Portable anymap', TRUE, $unpaper, $ocr)) {
+      if (! import_scan ("out$1.pnm", $1*$step+$offset, 'Portable anymap',
+                                  $SETTING{resolution}, TRUE, $unpaper, $ocr)) {
        $dialog -> destroy;
        $dialog = Gtk2::MessageDialog -> new ($windows, 'destroy-with-parent',
                          'error', 'close', $d->get('Unable to load image'));
@@ -2721,7 +2725,7 @@ sub hash2options {
 # Take new scan and display it
 
 sub import_scan {
- my ($ofilename, $page, $format, $delete, $unpaper, $ocr) = @_;
+ my ($ofilename, $page, $format, $resolution, $delete, $unpaper, $ocr) = @_;
 
  my %suffix = (
   'Portable Network Graphics'                    => '.png',
@@ -2744,8 +2748,9 @@ sub import_scan {
 
 # Block the row-changed signal whilst adding the scan (row) and sorting it.
  $slist -> get_model -> signal_handler_block($slist -> {signalid});
- push @{$slist -> {data}},
-                   [$page, get_pixbuf($filename, $heightt, $widtht), $filename];
+ push @{$slist -> {data}}, [ $page, 
+                             get_pixbuf($filename, $heightt, $widtht),
+                             $filename, undef, $resolution ];
  manual_sort_by_column ($slist, 0);
  $slist -> get_model -> signal_handler_unblock($slist -> {signalid});
 

--- a/bin/gscan2pdf	Wed Jun 13 13:21:59 2007 +0200
+++ b/bin/gscan2pdf	Thu Jun 14 06:56:42 2007 +0200
@@ -1499,7 +1499,6 @@ sub create_PDF {
    my $w = $image->Get('width');
    my $h = $image->Get('height');
    my $resolution = $slist -> {data}[$_][4];
-   $resolution = $image->Get('x-resolution') if (! defined($resolution));
 
    $page->mediabox($w*72/$resolution, $h*72/$resolution);
 
@@ -2734,6 +2733,13 @@ sub import_scan {
   'Portable anymap'                              => '.pnm',
   'CompuServe graphics interchange format'       => '.gif',
  );
+
+ if (! defined($resolution)) {
+  my $image = Image::Magick->new;
+  my $x = $image->Read($ofilename);
+  warn "$x" if "$x";
+  $resolution = $image->Get('x-resolution') if (! defined($resolution));
+ }
 
  my (undef, $filename) = tempfile(DIR => $dir, SUFFIX => $suffix{$format});
  if (defined($delete) and $delete) {



Index: gscan2pdf.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gscan2pdf/devel/gscan2pdf.spec,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- gscan2pdf.spec	5 Jun 2007 18:49:49 -0000	1.9
+++ gscan2pdf.spec	15 Jun 2007 03:57:07 -0000	1.10
@@ -1,12 +1,13 @@
 Name:           gscan2pdf
 Version:        0.9.10
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        A GUI for producing a multipage PDF from a scan
 
 Group:          Applications/Publishing
 License:        GPL
 URL:            http://gscan2pdf.sourceforge.net
 Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
+Patch0:         gscan2pdf-fix-paper-size.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 
@@ -21,7 +22,7 @@
 
 %prep
 %setup -q
-
+%patch -p1 -b .fix-paper-size
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor
@@ -71,6 +72,9 @@
 %{_mandir}/man1/*.1*
 
 %changelog
+* Thu Jun 14 2007 Bernard Johnson <bjohnson at symetrix.com> - 0.9.10-2
+- patch to fix paper size of output pdf file
+
 * Tue Jun 05 2007 Bernard Johnson <bjohnson at symetrix.com> - 0.9.10-1
 - v 0.9.10
 




More information about the scm-commits mailing list