aboutsummaryrefslogtreecommitdiffstats
path: root/examples/pdf-set-form-values.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2020-02-22 18:10:13 +0100
committerJay Berkenbilt <ejb@ql.org>2020-02-22 18:10:13 +0100
commitea58680eb07d1551d1f179532a3880e2d89f6c69 (patch)
treee33a091f1d5f7275ca269612c0288330ef09cd1c /examples/pdf-set-form-values.cc
parentbb3137296d4070e268690e8233e9d3eb2d64c652 (diff)
downloadqpdf-ea58680eb07d1551d1f179532a3880e2d89f6c69.tar.zst
Mention appearances in pdf-set-form-values example
Diffstat (limited to 'examples/pdf-set-form-values.cc')
-rw-r--r--examples/pdf-set-form-values.cc26
1 files changed, 13 insertions, 13 deletions
diff --git a/examples/pdf-set-form-values.cc b/examples/pdf-set-form-values.cc
index b0a4f2ad..becbedf3 100644
--- a/examples/pdf-set-form-values.cc
+++ b/examples/pdf-set-form-values.cc
@@ -73,23 +73,23 @@ int main(int argc, char* argv[])
annot_iter != annotations.end(); ++annot_iter)
{
// For each annotation, find its associated field. If
- // it's a text field, set its value. This will
- // automatically update the document to indicate that
- // appearance streams need to be regenerated. At the
- // time of this writing, qpdf doesn't have any helper
- // code to assist with appearance stream generation,
- // though there's nothing that prevents it from being
- // possible.
+ // it's a text field, set its value.
QPDFFormFieldObjectHelper ffh =
afdh.getFieldForAnnotation(*annot_iter);
if (ffh.getFieldType() == "/Tx")
{
- // Set the value. This will automatically set
- // /NeedAppearances to true. If you don't want to
- // do that, pass false as the second argument. For
- // details see comments in
- // QPDFFormFieldObjectHelper.hh.
- ffh.setV(value);
+ // Set the value. Passing false as the second
+ // value prevents qpdf from setting
+ // /NeedAppearances to true (but will not turn it
+ // off if it's already on), so we call
+ // generateAppearance after setting the value. You
+ // may or may not want to do this depending on
+ // whether the appearance streams generated by
+ // qpdf are good enough for your purposes. For
+ // additional details, please see comments in
+ // QPDFFormFieldObjectHelper.hh for this method.
+ ffh.setV(value, false);
+ ffh.generateAppearance(*annot_iter);
}
}
}