mirror of https://github.com/qpdf/qpdf.git
Mention appearances in pdf-set-form-values example
This commit is contained in:
parent
bb3137296d
commit
ea58680eb0
|
@ -1,5 +1,9 @@
|
||||||
2020-02-22 Jay Berkenbilt <ejb@ql.org>
|
2020-02-22 Jay Berkenbilt <ejb@ql.org>
|
||||||
|
|
||||||
|
* Update pdf-set-form-values.cc to use and mention
|
||||||
|
generateAppearance, which hadn't been added when the example was
|
||||||
|
originally created.
|
||||||
|
|
||||||
* Detect, warn, and correct the case of /Pages in the document
|
* Detect, warn, and correct the case of /Pages in the document
|
||||||
catalog incorrectly pointing to a page or intermediate node
|
catalog incorrectly pointing to a page or intermediate node
|
||||||
instead of the root of the pages tree. Fixes #398.
|
instead of the root of the pages tree. Fixes #398.
|
||||||
|
|
|
@ -73,23 +73,23 @@ int main(int argc, char* argv[])
|
||||||
annot_iter != annotations.end(); ++annot_iter)
|
annot_iter != annotations.end(); ++annot_iter)
|
||||||
{
|
{
|
||||||
// For each annotation, find its associated field. If
|
// For each annotation, find its associated field. If
|
||||||
// it's a text field, set its value. This will
|
// it's a text field, set its value.
|
||||||
// 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.
|
|
||||||
QPDFFormFieldObjectHelper ffh =
|
QPDFFormFieldObjectHelper ffh =
|
||||||
afdh.getFieldForAnnotation(*annot_iter);
|
afdh.getFieldForAnnotation(*annot_iter);
|
||||||
if (ffh.getFieldType() == "/Tx")
|
if (ffh.getFieldType() == "/Tx")
|
||||||
{
|
{
|
||||||
// Set the value. This will automatically set
|
// Set the value. Passing false as the second
|
||||||
// /NeedAppearances to true. If you don't want to
|
// value prevents qpdf from setting
|
||||||
// do that, pass false as the second argument. For
|
// /NeedAppearances to true (but will not turn it
|
||||||
// details see comments in
|
// off if it's already on), so we call
|
||||||
// QPDFFormFieldObjectHelper.hh.
|
// generateAppearance after setting the value. You
|
||||||
ffh.setV(value);
|
// 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Loading…
Reference in New Issue