aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qpdf-ctest.c
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2011-08-11 16:48:37 +0200
committerJay Berkenbilt <ejb@ql.org>2011-08-11 16:48:37 +0200
commit14fe2e6de3ae3b91436ccb4948fca75c29565440 (patch)
tree7db510d20d62b298408ddf50c8302b7c5c0bc0dc /qpdf/qpdf-ctest.c
parentce358f103e51f5779b2e58a70b1439f5da7c5298 (diff)
downloadqpdf-14fe2e6de3ae3b91436ccb4948fca75c29565440.tar.zst
qpdf_set_info_key, qpdf_get_info_key
Diffstat (limited to 'qpdf/qpdf-ctest.c')
-rw-r--r--qpdf/qpdf-ctest.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/qpdf/qpdf-ctest.c b/qpdf/qpdf-ctest.c
index 0797d9a2..aa61b9a1 100644
--- a/qpdf/qpdf-ctest.c
+++ b/qpdf/qpdf-ctest.c
@@ -325,6 +325,36 @@ static void test15(char const* infile,
report_errors();
}
+static void print_info(char const* key)
+{
+ char const* value = qpdf_get_info_key(qpdf, key);
+ printf("Info key %s: %s\n",
+ key, (value ? value : "(null)"));
+}
+
+static void test16(char const* infile,
+ char const* password,
+ char const* outfile,
+ char const* outfile2)
+{
+ qpdf_read(qpdf, infile, password);
+ print_info("/Author");
+ print_info("/Producer");
+ print_info("/Creator");
+ qpdf_set_info_key(qpdf, "/Author", "Mr. Potato Head");
+ qpdf_set_info_key(qpdf, "/Producer", "QPDF libary");
+ qpdf_set_info_key(qpdf, "/Creator", 0);
+ print_info("/Author");
+ print_info("/Producer");
+ print_info("/Creator");
+ qpdf_init_write(qpdf, outfile);
+ qpdf_set_static_ID(qpdf, QPDF_TRUE);
+ qpdf_set_static_aes_IV(qpdf, QPDF_TRUE);
+ qpdf_set_stream_data_mode(qpdf, qpdf_s_uncompress);
+ qpdf_write(qpdf);
+ report_errors();
+}
+
int main(int argc, char* argv[])
{
char* p = 0;
@@ -380,6 +410,7 @@ int main(int argc, char* argv[])
(n == 13) ? test13 :
(n == 14) ? test14 :
(n == 15) ? test15 :
+ (n == 16) ? test16 :
0);
if (fn == 0)