Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > Sample Code
  New Posts New Posts RSS Feed - Create & fill Checkboxes and Radiobuttons in code
  FAQ FAQ  Forum Search   Register Register  Login Login

Create & fill Checkboxes and Radiobuttons in code

 Post Reply Post Reply
Author
Message
AndrewC View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 08 Dec 10
Location: Geelong, Aust
Status: Offline
Points: 841
Post Options Post Options   Thanks (0) Thanks(0)   Quote AndrewC Quote  Post ReplyReply Direct Link To This Post Topic: Create & fill Checkboxes and Radiobuttons in code
    Posted: 17 Jul 12 at 3:29PM

Here is some simple code to create 2 checkboxes and 2 radio buttons.  The radio buttons are grouped together and the QP.SetFormFieldValue function is used to fill the field with a value.

Andrew.

            QP.SetOrigin(1);

            int y = 50;

            QP.SetTextSize(16);
            QP.DrawText(50, y - 10, "Check Boxes");

            int c1 = QP.NewFormField("Check1", 3);    // Type = Checkbox
            QP.SetFormFieldBounds(c1, 50, y, 20, 20);
            QP.SetFormFieldCheckStyle(c1, 1, 1);        // Style = Check, Centred 
            QP.SetFormFieldValue(c1, "Off");

            int c2 = QP.NewFormField("Check2", 3);
            QP.SetFormFieldBounds(c2, 90, y, 20, 20);
            QP.SetFormFieldCheckStyle(c2, 1, 1);       // Style = Check, Centred 
            QP.SetFormFieldValue(c2, "Yes");

            y += 80;
            QP.DrawText(50, y - 10, "Radio Buttons");

            int r0 = QP.NewFormField("RadioParent", 4);  // Type = Radiobutton

            int r1 = QP.AddFormFieldSub(r0, "Radio1");
            QP.SetFormFieldBounds(r1, 50, y, 20, 20);
            QP.SetFormFieldCheckStyle(r1, 2, 1);   // Radio, Centred

            int r2 = QP.AddFormFieldSub(r0, "Radio2");
            QP.SetFormFieldBounds(r2, 90, y, 20, 20);
            QP.SetFormFieldCheckStyle(r2, 2, 1);   // Radio, Centred

            QP.SetFormFieldValue(r0, "Radio2");

            QP.SaveToFile("out.pdf");

Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store