[poppler] poppler Digest, Vol 64, Issue 23

Carlos Garcia Campos carlosgc at gnome.org
Wed Jun 16 03:04:36 PDT 2010

Excerpts from srinivas adicherla's message of mié jun 16 11:52:17 +0200 2010:
> Hi Carlos Garcia Campos,


>     You mentioned about the new function "poppler_page_get_bounding_box()".
> It returns the effective bounding box of the page. What do you mean by
> effective bounding box? Is it the page bounding box excluding the margins on
> left,right,top,bottom ? If So, I am also trying the same thing for getting
> the bounding box of the page.
>          I need some suggestions. Iam doing something like this
>   1) we have the way to get the TextBlocks bounding boxes from the
> TextOutPutDev file. Taking the minX,minY,maxX,maxY of all TextBlocks
> bounding box will give the page bounding box excluding margins. But some pdf
> files having Graphic Streams at the start and end of the pages. For those
> pages it wil not give the correct bounding box. Give me any ideas how to do
> those.
>   2) In poppler_page_get_image_mapping() it will give the starting (x,y)
> co-ordinates and width,height of the image. But how do we know scaling
> factor of the image stored in the file. ( this is for all)

Using a cairo recording surface it's pretty easy, this is the function
I'll add as soon as cairo 1.10 is out (maybe before with #ifdefs):

poppler_page_get_bounding_box (PopplerPage      *page,
                              PopplerRectangle *rect)
  cairo_surface_t *rsurface;
  cairo_t *cr;
  double x, y, width, height;

  rsurface = cairo_recording_surface_create (CAIRO_CONTENT_COLOR, NULL);
  cr = cairo_create (rsurface);
  poppler_page_render (page, cr);
  cairo_destroy (cr);

  cairo_recording_surface_ink_extents (rsurface, &x, &y, &width, &height);
  cairo_surface_destroy (rsurface);

  rect->x1 = x;
  rect->x2 = x + width;
  rect->y1 = y;
  rect->y2 = y + height;

> Thanks & Regards
Carlos Garcia Campos
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20100616/9e7e641f/attachment.pgp>

More information about the poppler mailing list