[poppler] poppler Digest, Vol 64, Issue 23

srinivas adicherla srinivas.adicherla at gmail.com
Wed Jun 16 02:52:17 PDT 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)

Thanks & Regards

--
A Srinivas




On Wed, Jun 16, 2010 at 12:30 AM, <poppler-request at lists.freedesktop.org>wrote:

> Send poppler mailing list submissions to
>        poppler at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://lists.freedesktop.org/mailman/listinfo/poppler
> or, via email, send a message with subject or body 'help' to
>        poppler-request at lists.freedesktop.org
>
> You can reach the person managing the list at
>        poppler-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of poppler digest..."
>
>
> Today's Topics:
>
>   1. glib/poppler-document.cc glib/poppler-page.cc
>      (Carlos Garcia Campos)
>   2. Re: KMP for search (Albert Astals Cid)
>   3. Changes and possible api break in glib frontend for 0.16
>      (Carlos Garcia Campos)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Tue, 15 Jun 2010 08:45:41 -0700 (PDT)
> From: carlosgc at kemper.freedesktop.org (Carlos Garcia Campos)
> Subject: [poppler] glib/poppler-document.cc glib/poppler-page.cc
> To: poppler at lists.freedesktop.org
> Message-ID: <20100615154542.6AB4B10057 at kemper.freedesktop.org>
>
>  glib/poppler-document.cc |   12 ++++++------
>  glib/poppler-page.cc     |   17 ++++++++++-------
>  2 files changed, 16 insertions(+), 13 deletions(-)
>
> New commits:
> commit 25494311c5b8eb88d43df420ec91a1aedad20d05
> Author: Carlos Garcia Campos <carlosgc at gnome.org>
> Date:   Tue Jun 15 17:44:23 2010 +0200
>
>    [glib] Add some G_UNLIKELY()
>
> diff --git a/glib/poppler-document.cc b/glib/poppler-document.cc
> index 76a05a1..b265a34 100644
> --- a/glib/poppler-document.cc
> +++ b/glib/poppler-document.cc
> @@ -1171,7 +1171,7 @@ poppler_index_iter_next (PopplerIndexIter *iter)
>  void
>  poppler_index_iter_free (PopplerIndexIter *iter)
>  {
> -       if (iter == NULL)
> +       if (G_UNLIKELY (iter == NULL))
>                return;
>
>        g_object_unref (iter->document);
> @@ -1305,7 +1305,7 @@ poppler_fonts_iter_copy (PopplerFontsIter *iter)
>  void
>  poppler_fonts_iter_free (PopplerFontsIter *iter)
>  {
> -       if (iter == NULL)
> +       if (G_UNLIKELY (iter == NULL))
>                return;
>
>        deleteGooList (iter->items, FontInfo);
> @@ -1424,7 +1424,7 @@ layer_new (OptionalContentGroup *oc)
>  static void
>  layer_free (Layer *layer)
>  {
> -  if (!layer)
> +  if (G_UNLIKELY (!layer))
>     return;
>
>   if (layer->kids) {
> @@ -1589,8 +1589,8 @@ _poppler_document_get_layers (PopplerDocument
> *document)
>  static void
>  poppler_document_layers_free (PopplerDocument *document)
>  {
> -  if (!document->layers)
> -         return;
> +  if (G_UNLIKELY (!document->layers))
> +    return;
>
>   g_list_foreach (document->layers, (GFunc)layer_free, NULL);
>   g_list_free (document->layers);
> @@ -1644,7 +1644,7 @@ poppler_layers_iter_copy (PopplerLayersIter *iter)
>  void
>  poppler_layers_iter_free (PopplerLayersIter *iter)
>  {
> -  if (iter == NULL)
> +  if (G_UNLIKELY (iter == NULL))
>     return;
>
>   g_object_unref (iter->document);
> diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
> index 14601a6..19ea941 100644
> --- a/glib/poppler-page.cc
> +++ b/glib/poppler-page.cc
> @@ -891,7 +891,7 @@ poppler_page_get_selection_region (PopplerPage
>   *page,
>  void
>  poppler_page_selection_region_free (GList *region)
>  {
> -  if (!region)
> +  if (G_UNLIKELY (!region))
>     return;
>
>   g_list_foreach (region, (GFunc)poppler_rectangle_free, NULL);
> @@ -1137,7 +1137,7 @@ poppler_page_get_image (PopplerPage *page,
>  void
>  poppler_page_free_image_mapping (GList *list)
>  {
> -  if (list == NULL)
> +  if (G_UNLIKELY (list == NULL))
>     return;
>
>   g_list_foreach (list, (GFunc)poppler_image_mapping_free, NULL);
> @@ -1317,7 +1317,7 @@ poppler_page_get_link_mapping (PopplerPage *page)
>  void
>  poppler_page_free_link_mapping (GList *list)
>  {
> -  if (list == NULL)
> +  if (G_UNLIKELY (list == NULL))
>     return;
>
>   g_list_foreach (list, (GFunc)poppler_link_mapping_free, NULL);
> @@ -1380,7 +1380,7 @@ poppler_page_get_form_field_mapping (PopplerPage
> *page)
>  void
>  poppler_page_free_form_field_mapping (GList *list)
>  {
> -  if (list == NULL)
> +  if (G_UNLIKELY (list == NULL))
>     return;
>
>   g_list_foreach (list, (GFunc) poppler_form_field_mapping_free, NULL);
> @@ -1507,7 +1507,7 @@ poppler_page_get_annot_mapping (PopplerPage *page)
>  void
>  poppler_page_free_annot_mapping (GList *list)
>  {
> -  if (!list)
> +  if (G_UNLIKELY (!list))
>     return;
>
>   g_list_foreach (list, (GFunc)poppler_annot_mapping_free, NULL);
> @@ -1593,6 +1593,9 @@ poppler_link_mapping_copy (PopplerLinkMapping
> *mapping)
>  void
>  poppler_link_mapping_free (PopplerLinkMapping *mapping)
>  {
> +  if (G_UNLIKELY (!mapping))
> +    return;
> +
>   if (mapping->action)
>     poppler_action_free (mapping->action);
>
> @@ -1677,7 +1680,7 @@ poppler_form_field_mapping_copy
> (PopplerFormFieldMapping *mapping)
>  void
>  poppler_form_field_mapping_free (PopplerFormFieldMapping *mapping)
>  {
> -  if (!mapping)
> +  if (G_UNLIKELY (!mapping))
>     return;
>
>   if (mapping->field)
> @@ -1713,7 +1716,7 @@ poppler_annot_mapping_copy (PopplerAnnotMapping
> *mapping)
>  void
>  poppler_annot_mapping_free (PopplerAnnotMapping *mapping)
>  {
> -  if (!mapping)
> +  if (G_UNLIKELY (!mapping))
>     return;
>
>   if (mapping->annot)
>
>
> ------------------------------
>
> Message: 2
> Date: Tue, 15 Jun 2010 19:05:25 +0100
> From: Albert Astals Cid <aacid at kde.org>
> Subject: Re: [poppler] KMP for search
> To: poppler at lists.freedesktop.org
> Message-ID: <201006151905.25318.aacid at kde.org>
> Content-Type: Text/Plain;  charset="us-ascii"
>
> A Dimarts, 15 de juny de 2010, Johannes Buchner va escriure:
> > Hi!
>
> Hi
>
> > I implemented the KMP search algorithm in [1] but I feel it doesn't
> > get attention. Please apply [2] and test it.
>
> You sent a mail yesterday and already complain you are being ignored?
>
> >
> > [1] https://bugs.freedesktop.org/show_bug.cgi?id=8821
> > [2] https://bugs.freedesktop.org/attachment.cgi?id=36255
> >
> > To be honest, the gain is small;
>
> If the gain is small i'd prefer to stay with our tested code than to switch
> to
> something totally new.
>
> > I find it odd that the search
> > function is page-based and runs per block (sorry, I'm new to poppler).
> > It strikes me that no wrapped words can ever be found.
> >
> > Perhaps it would also make sense to put a '#pragma omp for' in front of
> > the whole-document search? (For those not familiar with OpenMP,
> > this simply parallizes the search over the available CPUs.)
>
> I don't think depending on OpenMP is an option.
>
> Albert
>
> >
> > Cheers,
> > Johannes
>
>
> ------------------------------
>
> Message: 3
> Date: Tue, 15 Jun 2010 20:44:50 +0200
> From: Carlos Garcia Campos <carlosgc at gnome.org>
> Subject: [poppler] Changes and possible api break in glib frontend for
>        0.16
> To: poppler <poppler at lists.freedesktop.org>
> Message-ID: <1276617261-sup-4132 at charmaleon>
> Content-Type: text/plain; charset="utf8"
>
> Hi all,
>
> there are some planned changes and possible api breakages for this
> devel cycle that I would like to comment here.
>
>  - The GDK api will be marked as deprecated for 0.16 and definitely
>  removed in 0.17/0.18. In this moment GDK api is just a wrapper over
>  the cairo one, so it doesn't make sense to depend on gdk just for
>  that.
>
>  - poppler_page_get_selection_region(). This method was already
>  changed to return a GList * of PopplerRectangles instead of a
>  GdkRegion when we made gdk an optional dependency. Now that gdk
>  api is deprecated it probably makes sense to return a cairo_region_t
>  * instead. The main problem is that cairo_region is cairo 1.10 api, so
>  we need to trust it will be released on August as planned.
>
>  - poppler_page_get_text(). This method is confusing, it receives a
>  PopplerRectangle and PopplerSelectionStyle, so I think it might be
>  renamed to poppler_page_get_selected_text(), since it actually
>  returns the text contained in the selection contained in the given
>  rectangle. Then we can add poppler_page_get_text() as convenient
>  method to get the whole text of the page.
>
>  - poppler_page_get_text_layout(). Daniel Garcia is already working on
>  this. It returns an array of PopplerRectangles that are the bounding
>  boxes of every character in the page. The array index is the
>  character offset of the string returned by (the new)
>  poppler_page_get_text().
>
>  - printing options. I would like to add a way to specify options when
>  rendering for printing, like not rendering annotations. We could add
>  an options parameter to poppler_page_render_for_printing() or maybe
>  we can avoid breaking the api and just add
>  poppler_page_render_for_printing_with_options().
>
>  - In PopplerDocument, linearized property is an string containing
>  "Yes" or "No", it should be a boolean. I plan to add accessors for
>  all properties in PopplerDocument and PopplerPage, to make properties
>  easier to discover.
>
>  - poppler_page_get_bounding_box(). This will be a new method that
>  returns the effective bounding box of the page. It would allow
>  viewers to implement fit-to-contents zoom as well as FitB*
>  destinations. This needs cairo 1.10 (recording surface)
>
>  - GObject introspection support.
>
> I think I don't forget anything. Comments? Objections?
>
> 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/20100615/2994e31e/attachment-0001.pgp
> >
>
> ------------------------------
>
> _______________________________________________
> poppler mailing list
> poppler at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/poppler
>
>
> End of poppler Digest, Vol 64, Issue 23
> ***************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20100616/b6f15ef2/attachment.html>


More information about the poppler mailing list