I have rolled a pending PDF::Reuse release which incorporates several
methods which I wrote to accommodate the label and patroncard tools in Koha
back in 2009. I had hoped these would be included in PDF::Reuse before now;
however, they were not. The module appears to have been abandoned by the
original author, and I was able to be listed as a co-maintainer.

I have tested these changes on Koha's current head, and they appear to work
fine. This is an official call for testing these changes prior to my
releasing the new version of PDF::Reuse.

Since these changes directly affect Koha, they have the potential to affect
current and future stable installs. Below is a link to a dev release of
PDF::Reuse which contains the proposed changes. Attached is a patch
formatted against the head current at the time of this email. Please do the
following:

1. Upgrade PDF::Reuse to 0.35_01.
2. Run Koha's non-DB dependent test suite. You should notice some non-fatal
warnings about the redefinition of one or two subs in PDF::Reuse. This
should not affect the functionality of the tools for the end user.
3. Verify the functionality of the related tools.
4. Apply the attached patch.
5. Re-run Koha's non-DB dependent test suite. You should note no warnings
related to PDF::Reuse.
6. Re-verify the functionality of the related tools.
7. Reply to the list with any issue which arise.

After we're happy with the changes, I will submit the attached patch to
Koha via normal channels for QA, etc.

This conversation will serve as QA for the proposed PDF::Reuse release.
There are many things which could be different about the code in
PDF::Reuse. This release is not the time to deal with these, so please keep
it to show-stopping problems. There will be plenty of time to "fix" other
things later. (That said, feel free to send along any thoughts directly to
me.)

Kind Regards,
Chris


http://backpan.perl.org/authors/id/C/CN/CNIGHS/PDF-Reuse-0.35_01.tar.gz
From 59bd8030614e60dc69df838db58c7f227b54d483 Mon Sep 17 00:00:00 2001
From: Chris Nighswonger <[email protected]>
Date: Tue, 2 Dec 2014 12:08:04 -0500
Subject: [PATCH] Removing depricated code; These methods are now included in
 the underlying package PDF::Reuse

---
 C4/Creators/PDF.pm | 92 +-----------------------------------------------------
 1 file changed, 1 insertion(+), 91 deletions(-)

diff --git a/C4/Creators/PDF.pm b/C4/Creators/PDF.pm
index 738c34f..253c53f 100644
--- a/C4/Creators/PDF.pm
+++ b/C4/Creators/PDF.pm
@@ -170,97 +170,7 @@ sub AltJpeg {
 sub Jpeg {
     my $self = shift;
     my ($imageData, $width, $height, $imageFormat) = @_;
-    return prJpegBlob($imageData, $width, $height, $imageFormat);
-}
-
-# FIXME: This magick foo is an absolute hack until the maintainer of PDF::Reuse releases the next version which will include these features
-
-sub prAltJpeg
-{  my ($iData, $iWidth, $iHeight, $iFormat,$aiData, $aiWidth, $aiHeight, $aiFormat) = @_;
-   my ($namnet, $utrad);
-   if (! $PDF::Reuse::pos)                    # If no output is active, it is no use to continue
-   {   return;
-   }
-   prJpegBlob($aiData, $aiWidth, $aiHeight, $aiFormat);
-   my $altObjNr = $PDF::Reuse::objNr;
-   $PDF::Reuse::imageNr++;
-   $namnet = 'Ig' . $PDF::Reuse::imageNr;
-   $PDF::Reuse::objNr++;
-   $PDF::Reuse::objekt[$PDF::Reuse::objNr] = $PDF::Reuse::pos;
-   $utrad = "$PDF::Reuse::objNr 0 obj\n" .
-            "[ << /Image $altObjNr 0 R\n" .
-            "/DefaultForPrinting true\n" .
-            ">>\n" .
-            "]\n" .
-            "endobj\n";
-   $PDF::Reuse::pos += syswrite *PDF::Reuse::UTFIL, $utrad;
-   if ($PDF::Reuse::runfil)
-   {  $PDF::Reuse::log .= "Jpeg~AltImage\n";
-   }
-   $PDF::Reuse::objRef{$namnet} = $PDF::Reuse::objNr;
-   $namnet = prJpegBlob($iData, $iWidth, $iHeight, $iFormat, $PDF::Reuse::objNr);
-   if (! $PDF::Reuse::pos)
-   {  errLog("No output file, you have to call prFile first");
-   }
-   return $namnet;
-}
-
-sub prJpegBlob
-{  my ($iData, $iWidth, $iHeight, $iFormat, $altArrayObjNr) = @_;
-   my ($iLangd, $namnet, $utrad);
-   if (! $PDF::Reuse::pos)                    # If no output is active, it is no use to continue
-   {   return;
-   }
-   my $checkidOld = $PDF::Reuse::checkId;
-   if (!$iFormat)
-   {   my ($iFile, $checkId) = findGet($iData, $checkidOld);
-       if ($iFile)
-       {  $iLangd = (stat($iFile))[7];
-          $PDF::Reuse::imageNr++;
-          $namnet = 'Ig' . $PDF::Reuse::imageNr;
-          $PDF::Reuse::objNr++;
-          $PDF::Reuse::objekt[$PDF::Reuse::objNr] = $PDF::Reuse::pos;
-          open (my $fh, '<', "$iFile") || errLog("Couldn't open $iFile, $!, aborts");
-          binmode $fh;
-          my $iStream;
-          sysread $fh, $iStream, $iLangd;
-          $utrad = "$PDF::Reuse::objNr 0 obj\n<</Type/XObject/Subtype/Image/Name/$namnet" .
-                    "/Width $iWidth /Height $iHeight /BitsPerComponent 8 " .
-                    ($altArrayObjNr ? "/Alternates $altArrayObjNr 0 R " : "") .
-                    "/Filter/DCTDecode/ColorSpace/DeviceRGB"
-                    . "/Length $iLangd >>stream\n$iStream\nendstream\nendobj\n";
-          close $fh;
-          $PDF::Reuse::pos += syswrite $PDF::Reuse::UTFIL, $utrad;
-          if ($PDF::Reuse::runfil)
-          {  $PDF::Reuse::log .= "Cid~$PDF::Reuse::checkId\n";
-             $PDF::Reuse::log .= "Jpeg~$iFile~$iWidth~$iHeight\n";
-          }
-          $PDF::Reuse::objRef{$namnet} = $PDF::Reuse::objNr;
-       }
-       undef $checkId;
-   }
-   elsif ($iFormat == 1)
-   {  my $iBlob = $iData;
-      $iLangd = length($iBlob);
-      $PDF::Reuse::imageNr++;
-      $namnet = 'Ig' . $PDF::Reuse::imageNr;
-      $PDF::Reuse::objNr++;
-      $PDF::Reuse::objekt[$PDF::Reuse::objNr] = $PDF::Reuse::pos;
-      $utrad = "$PDF::Reuse::objNr 0 obj\n<</Type/XObject/Subtype/Image/Name/$namnet" .
-                "/Width $iWidth /Height $iHeight /BitsPerComponent 8 " .
-                ($altArrayObjNr ? "/Alternates $altArrayObjNr 0 R " : "") .
-                "/Filter/DCTDecode/ColorSpace/DeviceRGB"
-                . "/Length $iLangd >>stream\n$iBlob\nendstream\nendobj\n";
-      $PDF::Reuse::pos += syswrite *PDF::Reuse::UTFIL, $utrad;
-      if ($PDF::Reuse::runfil)
-      {  $PDF::Reuse::log .= "Jpeg~Blob~$iWidth~$iHeight\n";
-      }
-      $PDF::Reuse::objRef{$namnet} = $PDF::Reuse::objNr;
-   }
-   if (! $PDF::Reuse::pos)
-   {  errLog("No output file, you have to call prFile first");
-   }
-   return $namnet;
+    return prJpeg($imageData, $width, $height, $imageFormat);
 }
 
 sub Js {
-- 
1.9.1

_______________________________________________
Koha-devel mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to