Adding any form object on top

Adding any form object on top

Forum member · Apr 3, 2013
I have an Image Field created in LiveCycle that is always on top. I want to place some white space over it (just try to add a rectangle over it). Anytime I try to place a new DynamicPDF form/object over the Image Field it will place it underneath the original Image Field. I also sent it (the Image Field) "to back" using LiveCycle with results. I can't use the FormFields option set to false method because I have other text fields on the PDF that need to stay in place. I am using the StampTemplate method as shown below and still won't work. Been banging my head for 2 days now on this problem. Dim NewDoc As MergeDocument = New MergeDocument("sample.pdf") Dim MyTemplate2 As Template = New Template() Dim MyCmykColor1 As CmykColor = New CmykColor(0.5F, 0.3F, 0.6F, 0.0F) MyTemplate2.Elements.Add(New ceTe.DynamicPDF.PageElements.Rectangle(0, 0, 200, 150, MyCmykColor1, MyCmykColor1)) NewDoc.StampTemplate = MyTemplate2

Re: Adding any form object on top

Support · Apr 5, 2013
Hello, If you add any page element over any of the form fields it will be added beneath the form field and this is desired behavior with our DynamicPDF product API. You can add TextField form field instead of adding page element like Label over the already existing image form field and make it read only. This will hide the already existing form field. Below is the sample code for it. PdfDocument pdf = new PdfDocument(@"C:\Test_2.pdf"); MergeDocument document = new MergeDocument(pdf); //Getting the page number on which the field is residing. int pagenumber = pdf.Form.Fields["form1[0].#subform[0].ImageField1[0]"].GetOriginalPageNumber() - 1; //Getting X,Y,width and Height of the already existing field. float xPosition = pdf.Form.Fields["form1[0].#subform[0].ImageField1[0]"].GetX(document.Pages[pagenumber]); float yPosition = pdf.Form.Fields["form1[0].#subform[0].ImageField1[0]"].GetY(document.Pages[pagenumber]); float width = pdf.Form.Fields["form1[0].#subform[0].ImageField1[0]"].Width; float height = pdf.Form.Fields["form1[0].#subform[0].ImageField1[0]"].Height; document.Form.Fields["form1[0].#subform[0].ImageField1[0]"].IsReadOnly = true; //Building a new form field to add it over the already existing one. ceTe.DynamicPDF.PageElements.Forms.TextField textField = new ceTe.DynamicPDF.PageElements.Forms.TextField("txtb", xPosition, yPosition, width, height); textField.BackgroundColor = RgbColor.White; textField.ReadOnly = true; document.Pages[0].Elements.Add(textField); document.Draw(@"C:\Mydocument.pdf"); Thanks, ceTe Software Support Team.

Re: Adding any form object on top

Forum member · Apr 5, 2013
Excellent solution. Thanks for showing me how to do this. I could not done this by myself.