[Poppler-bugs] [Bug 36653] Missing functions for setting document's properties
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Thu Apr 28 01:30:21 PDT 2011
https://bugs.freedesktop.org/show_bug.cgi?id=36653
--- Comment #1 from Rodrigo Moya <rodrigo at gnome.org> 2011-04-28 01:30:19 PDT ---
I wrote a simple test program to test it, so pasting here just in case it's
useful:
#include <poppler.h>
int
main (int argc, char *argv[])
{
PopplerDocument *document;
GError *error = NULL;
g_type_init ();
if (argc != 6) {
g_print ("Usage: %s filename output new_title new_author
new_subject\n", argv[0]);
return -1;
}
document = poppler_document_new_from_file (argv[1], NULL, &error);
if (!document) {
g_print ("Error opening %s: %s\n", argv[1], error->message);
g_error_free (error);
return -1;
}
g_print ("Changing title from %s to %s\n",
poppler_document_get_title (document),
argv[3]);
poppler_document_set_title (document, argv[3]);
g_print ("Changing author from %s to %s\n",
poppler_document_get_author (document),
argv[4]);
poppler_document_set_author (document, argv[4]);
g_print ("Changing subject from %s to %s\n",
poppler_document_get_subject (document),
argv[5]);
poppler_document_set_subject (document, argv[5]);
error = NULL;
if (!poppler_document_save (document, argv[2], &error)) {
g_print ("Error saving %s: %s\n", argv[2], error->message);
g_error_free (error);
return -1;
}
g_object_unref (document);
return 0;
}
--
Configure bugmail: https://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the Poppler-bugs
mailing list