-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Am 26.10.2013 15:44, schrieb Hans Bijkerk:
> Hi there,
> 
> First of all, thanks for the amazing work on poppler. It's been 
> very helpful on a lot of occasions.

I think general questions should be posed to the general audience on
the Poppler mailing list, so that everyone can benefit from the
question as well as possible answers.

> Currently, I'm looking for a fast way to generate a pngs or jpegs 
> from a PDF; pdftoppm delivers on speed and is exactly what I'm 
> looking for. (currently using the latest version, 0.24.2)
> 
> However, there is one small thing I can't figure out: All 
> hyperlinks within the PDF are rendered on the image output. Every 
> clickable item in the PDF is represented as a small black bordered 
> square.
> 
> This is the command I'm using:
> 
> *pdftoppm -f 1 -l 1 -scale-to-x 199 -scale-to-y 283  -cropbox -png
> 'my.pdf' > 'test.png'*
> 
> Which gives this as the output image:
> 
> 
> 
> All the squares are the hyperlinks, buy are invisible when reading 
> the PDF in apps like Acrobat.

Have you compared pdftoppm's rendering with applications that are
based on Poppler like Evince or Okular?

> For my current project, this is unwanted behavior and I'm looking 
> for a solution. This can be anything from a patch, a compile 
> option, or a small C "hack" to get it working (I have C knowledge, 
> btw).

In any case, you might want to look at line 216 of "pdftoppm.cc" where
PDFDoc::displayPageSlice is called and flags that control rendering
are set. The method signature is:

// Display part of a page.
void displayPageSlice(OutputDev *out, int page,
                        double hDPI, double vDPI, int rotate,
                        GBool useMediaBox, GBool crop, GBool printing,
                        int sliceX, int sliceY, int sliceW, int sliceH,
                        GBool (*abortCheckCbk)(void *data) = NULL,
                        void *abortCheckCbkData = NULL,
                        GBool (*annotDisplayDecideCbk)(Annot *annot,
void *user_data) = NULL,
                        void *annotDisplayDecideCbkData = NULL, GBool
copyXRef = gFalse);

If it just about enabling/disabling the printing flag, the attached
patch might help...

> Would love to hear any help, tips, pointers to code lines,
> 
> All the best, Hans B. The Netherlands
> 

Regards, Adam.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (GNU/Linux)

iQEcBAEBAgAGBQJSa9PZAAoJEPSSjE3STU34PBgH/2g6E8tQqTHZzm3+YwE+exhv
YNHL22u0+xabtmDZf+SVKa+bLpXc/nWMGp3chKQLPx2Zk7tIGVspkdMklUZ2fKFI
gnYlocALMhMh7eOXXR7TABJAwtR8vUFWJLfRCbDHPz0+9q8UOo7w11Is8vRtu9SU
mRFO6q1L19FmvbErCoAGE43PFP7umv6uWG/qExdYUFZo28mfcOWc6d0wvDj6ppxW
2XO3p7JQlxsT6KyZC1X3RXKZVWG4CfyvJpNhFPl1fEg9yMvZboTqsmT5NwMvHHfN
5KZD86Pm7ul9ZSOEid+F/SjKRERy2i8XVjA1RF2qMw+mPQcUJY9GrLaynKRtBRY=
=0mUJ
-----END PGP SIGNATURE-----
>From 2f7df6f64b4ef9455241c21554d7159c2050a8fa Mon Sep 17 00:00:00 2001
From: Adam Reichold <[email protected]>
Date: Sat, 26 Oct 2013 16:35:03 +0200
Subject: [PATCH] Add printing option to pdftoppm to instruct Splash to render
 images that are intended for printing.

---
 utils/pdftoppm.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/utils/pdftoppm.cc b/utils/pdftoppm.cc
index a3d4d10..59b4efa 100644
--- a/utils/pdftoppm.cc
+++ b/utils/pdftoppm.cc
@@ -79,6 +79,7 @@ static int w = 0;
 static int h = 0;
 static int sz = 0;
 static GBool useCropBox = gFalse;
+static GBool printing = gFalse;
 static GBool mono = gFalse;
 static GBool gray = gFalse;
 static GBool png = gFalse;
@@ -140,6 +141,8 @@ static const ArgDesc argDesc[] = {
    "size of crop square in pixels (sets W and H)"},
   {"-cropbox",argFlag,     &useCropBox,    0,
    "use the crop box rather than media box"},
+  {"-printing",argFlag,    &printing,      0,
+   "render images intended for printing"},
 
   {"-mono",   argFlag,     &mono,          0,
    "generate a monochrome PBM file"},
@@ -216,7 +219,7 @@ static void savePageSlice(PDFDoc *doc,
   doc->displayPageSlice(splashOut, 
     pg, x_resolution, y_resolution, 
     0,
-    !useCropBox, gFalse, gFalse,
+    !useCropBox, gFalse, printing,
     x, y, w, h
   );
 
-- 
1.8.4.1

_______________________________________________
poppler mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/poppler

Reply via email to