[poppler] Metadata access for glib wrapper

Carlos Garcia Campos carlosgc at gnome.org
Fri Jun 1 10:02:59 PDT 2007


El mié, 30-05-2007 a las 10:52 -0700, Jason Kivlighn escribió:
> Hi all,

hi Jason, 

> Here's a patch against CVS to allow the glib wrapper to access PDF XML
> metadata.  It simply adds a new QObject property and reads the
> metadata
> with Catalog::readMetadata()->toCString().
> 
> Having this functionality would really be handy for me.

some comments about your patch below. 

> Cheers,
> Jason
> 
>  
>  typedef struct _PopplerDocumentClass PopplerDocumentClass;
> @@ -691,6 +692,14 @@
>         flag |= POPPLER_PERMISSIONS_OK_TO_ADD_NOTES;
>        g_value_set_flags (value, flag);
>        break;
> +    case PROP_METADATA:
> +      catalog = document->doc->getCatalog ();
> +      if (catalog && catalog->isOk ())
> +       {
> +         GooString *s = catalog->readMetadata ();
> +         g_value_set_string (value, s->getCString());

readMetada could return NULL, so you should check it before using
s->getCString(). In addition, readMetadata returns a new allocated
GooString, so it should be freed here, just after using it. 

> +       }
> +      break;
>      default:
>        G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
>      }

Thanks, 
-- 
Carlos Garcia Campos
   elkalmail at yahoo.es
   carlosgc at gnome.org
   http://carlosgc.linups.org
PGP key: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x523E6462
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada
	digitalmente
Url : http://lists.freedesktop.org/archives/poppler/attachments/20070601/94f8d52b/attachment.pgp 


More information about the poppler mailing list