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

            IDictionary <String, PdfFormField> fields = form.GetFormFields();
            PdfFormField        field            = fields["timezone2"];
            PdfWidgetAnnotation widgetAnnotation = field.GetWidgets()[0];
            PdfArray            annotationRect   = widgetAnnotation.GetRectangle();

            // Change value of the right coordinate (index 2 corresponds with right coordinate)
            annotationRect.Set(2, new PdfNumber(annotationRect.GetAsNumber(2).FloatValue() - 10f));

            pdfDoc.Close();
        }
Ejemplo n.º 2
0
        protected void ManipulatePdf(String dest)
        {
            PdfDocument         pdfDoc           = new PdfDocument(new PdfReader(SRC), new PdfWriter(dest));
            PdfAcroForm         form             = PdfAcroForm.GetAcroForm(pdfDoc, true);
            PdfFormField        field            = form.GetField("Name");
            PdfWidgetAnnotation widgetAnnotation = field.GetWidgets()[0];
            PdfArray            annotationRect   = widgetAnnotation.GetRectangle();

            // Change value of the right coordinate (index 2 corresponds with right coordinate)
            annotationRect.Set(2, new PdfNumber(annotationRect.GetAsNumber(2).FloatValue() + 20f));

            String value = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" +
                           "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";

            field.SetValue(value);
            form.GetField("Company").SetValue(value);

            pdfDoc.Close();
        }
Ejemplo n.º 3
0
 /// <summary>Get the rectangle associated to the provided widget.</summary>
 /// <param name="widget">PdfWidgetAnnotation to extract the rectangle from</param>
 /// <returns>Rectangle</returns>
 protected internal virtual Rectangle GetWidgetRectangle(PdfWidgetAnnotation widget)
 {
     return(widget.GetRectangle().ToRectangle());
 }