Beispiel #1
0
        protected void ManipulatePdf(String dest)
        {
            PdfDocument pdfDoc = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest));
            PdfAcroForm form   = PdfAcroForm.GetAcroForm(pdfDoc, true);

            // Method removes the XFA stream from the document.
            form.RemoveXfaForm();

            IDictionary <String, PdfFormField> fields = form.GetFormFields();

            foreach (KeyValuePair <String, PdfFormField> name in fields)
            {
                if (name.Key.IndexOf("Total") > 0)
                {
                    name.Value.SetColor(ColorConstants.RED);
                }

                name.Value.SetValue("X");
            }

            pdfDoc.Close();
        }