[poppler] Trying to extend pdftoppm to use CairoOutputDev

mpsuzuki at hiroshima-u.ac.jp mpsuzuki at hiroshima-u.ac.jp
Mon Dec 14 18:28:54 PST 2009


Dear Poppler developers,

Before all, I thank poppler developers for writing excellent
software. The addition of CairoOutputDev is very interesting.

Now I'm trying to extend pdftoppm to draw on CairoOutputDev.
My motivation is splitting a large table in PDF document
into small PDFs for each cell.

Recent poppler has a feature to draw on cairo surface, so
I think it is possible to do such by pdftoppm draw a cell
(by the specification of geometry for a cell) on cairo surface,
something like:

  pdftoppm \
           -f [page_num] -l [page_num] \ 
           -r [dpi_to_specify_the_unit_of_geometry] \
           -x [cell_pos_x] -y [cell_pos_y]          \
           -w [cell_width] -h [cell_height]         \
           -pdf [input_table.pdf] [output_cell_prefix]

Attached patch is an experiment doing such, please comment
what should be improved for the official adoption.

By default, "-r" option for "pdftoppm -pdf" is used only
as an unit to calculate the geometry to be cropped, and
it does not change the resolution of output PDF. This is
inconsistent with "-r" option for SplashOutputDev cases.
If MODIFY_RESOLUTION_IN_PDF2CAIRO is defined in the compilation,
the behaviour of "-r" is consistent with the case of
SplashOutputDev.

The problems that I've already recognized are:

* If a PDF including large image (e.g. PDF generated by 
  image scanners) is given, the cropped PDF includes 
  whole image object, not cropped image object.
  The filesize of cropped PDF is not reduced.

* When multiple pages are rendered (e.g. pdftoppm -pdf
  -f 1 -l 100 ...), startDoc() is invoked for each
  output file. As a result, the rendering speed is
  slower than that of SplashOutputDev.

Regards,
mpsuzuki
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pdftoppm-cairo.patch
Type: text/x-diff
Size: 5369 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20091215/32fb37d6/attachment-0001.patch 


More information about the poppler mailing list