Package: pdfedit
Version: 0.4.5-1db1
Severity: normal
Tags: upstream patch

Hi Varun;

pdfedit cuts off wide text on rotated pages. Luckily upstream recently
fixed this bug in CVS. I have extracted the patch from CVS, and
rebuilt pdfedit with it. It seems to cause no harm, and fix the bug.
Would you mind carrying this patch in debian until upstream does
another release?

David


-- System Information:
Debian Release: squeeze/sid
  APT prefers testing
  APT policy: (900, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages pdfedit depends on:
ii  libc6                   2.11.2-6         Embedded GNU C Library: Shared lib
ii  libfreetype6            2.4.2-1          FreeType 2 font engine, shared lib
ii  libgcc1                 1:4.4.4-8        GCC support library
ii  libqt3-mt               3:3.3.8b-7+b1    Qt GUI Library (Threaded runtime v
ii  libstdc++6              4.4.4-8          The GNU Standard C++ Library v3
ii  libx11-6                2:1.3.3-3        X11 client-side library
ii  libxext6                2:1.1.2-1        X11 miscellaneous extension librar
ii  zlib1g                  1:1.2.3.4.dfsg-3 compression library - runtime

pdfedit recommends no packages.

pdfedit suggests no packages.

-- no debconf information
commit 450da4b84eeaa9614e5cbc73957ff165d1dda974
Author: misuj1am <misuj1am>
Date:   Fri Jul 30 07:31:13 2010 +0000

    use page media box/rotation when getting text from a page instead of 
relying on the default values.

diff --git a/src/kernel/cpagecontents.cc b/src/kernel/cpagecontents.cc
index bf2240e..3bc8d63 100644
--- a/src/kernel/cpagecontents.cc
+++ b/src/kernel/cpagecontents.cc
@@ -400,6 +400,12 @@ CPageContents::getText (std::string& text, const string* 
encoding, const libs::R
 
        // Get the text
        libs::Rectangle rec = (rc)? *rc : _page->display()->getPageRect();
+       // if we use rotation 90,270 then we must change the rectangle from 
which we want the text
+       // accordingly (TODO - verify for all rotations)
+       int rot = _page->getRotation ();
+       if (90 == rot || 270 == rot)
+               std::swap (rec.xright, rec.yright);
+
        scoped_ptr<GString> gtxt (textDev->getText(rec.xleft, rec.yleft, 
rec.xright, rec.yright));
        text = gtxt->getCString();
 }
diff --git a/src/tools/pdf_to_text.cc b/src/tools/pdf_to_text.cc
index dcf8626..97d2f4d 100644
--- a/src/tools/pdf_to_text.cc
+++ b/src/tools/pdf_to_text.cc
@@ -47,6 +47,14 @@ namespace {
        struct _textify {
                string operator () (shared_ptr<CPage> page)
                {
+                       // Update display params to use media box not default 
page rect (DEFAULT_PAGE_RX, DEFAULT_PAGE_RY)
+                       // TODO upsidedown? get/set
+                       DisplayParams dp;
+                       dp.useMediaBox = gTrue;
+                       dp.crop = gFalse;
+                       dp.rotate = page->getRotation ();
+                       page->setDisplayParams (dp);
+
                        string text;
                        static const std::string encoding="UTF-8";
                        page->getText (text, &encoding);

Reply via email to