[poppler] poppler question about pdftoppm

Adam Reichold adamreichold at myopera.com
Sat Oct 26 07:38:17 PDT 2013

Hash: SHA1


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.
Version: GnuPG v2.0.22 (GNU/Linux)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdftoppm-printing.diff
Type: text/x-patch
Size: 1346 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20131026/d05c1aee/attachment.bin>

More information about the poppler mailing list