Components for Developers
© 2000-2012, Two Pilots

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

PDF Creator Pilot documentation

Download CHM version of this manual.
How to Create Fillable PDF Forms

Example
Collapse All

Example

C++

[copy to clipboard]
const int MAX_LENGHT = 20;
PM_DOCUMENT doc = PM_DOCUMENT_New();
PM_FONT font = PM_DOCUMENT_AddFont(doc, "Arial", true, false);
	
PM_RECT rc = {0, 0, 600, 800};
PM_RECT rcEditBox_Name = {70, 770, 210, 790};
PM_RECT rcRadioButtonMale = {10,740,30,760};
PM_RECT rcRadioButtonFemale = {10,720,30,740};
PM_RECT rcComboBox_Status = {70, 700, 210, 720};
PM_RECT rcButton_Confirm = {10,650,210,680};
PM_RECT rcListBox_Info = {40, 550, 210, 610};
PM_PAGE page = PM_DOCUMENT_AddPage(doc, rc);

PM_CANVAS canvas = PM_PAGE_GetCanvas(page);
PM_CANVAS_UseFont(canvas, font, 10); 
PM_CANVAS_ShowText(canvas,10, 780,"Your Name:", 0);

PM_ANNOTATION editBoxName = PM_PAGE_AddEditBox(page, rcEditBox_Name, "EditBox_Name", doc);
PM_ANNOT_WIDGET_EDITBOX_SetMaxLength(editBoxName, MAX_LENGHT);
PM_ANNOT_WIDGET_EDITBOX_SetTextAlign(editBoxName, taLeft); //taLeft, taRight, taCenter
PM_ANNOT_WIDGET_EDITBOX_SetValue(editBoxName, "Unknown");

PM_ANNOTATION radioButtonMale = PM_PAGE_AddRadioButton(page, rcRadioButtonMale, "Male", doc);
PM_ANNOT_WIDGET_RADIOBUTTON_SetChecked(radioButtonMale, true);
PM_CANVAS_ShowText(canvas,40, 750,"Male", 0);

PM_ANNOTATION radioButtonFemale = PM_PAGE_AddRadioButton(page, rcRadioButtonFemale, "Female", doc);
PM_ANNOT_WIDGET_RADIOBUTTON_SetChecked(radioButtonMale, false);
PM_CANVAS_ShowText(canvas,40, 730,"Female", 0);

PM_ANNOTATION comboBoxStatus = PM_PAGE_AddComboBox(page, rcComboBox_Status, "ComboBox_Status", doc);
	
PM_CANVAS_ShowText(canvas,10, 710,"Status:", 0);
PM_ANNOT_WIDGET_COMBOBOX_SetEditable(comboBoxStatus, false);
PM_ANNOT_WIDGET_CHOICE_AddItem(comboBoxStatus, "Single");
PM_ANNOT_WIDGET_CHOICE_AddItem(comboBoxStatus, "Dating");
PM_ANNOT_WIDGET_CHOICE_AddItem(comboBoxStatus, "Married");

PM_ANNOTATION buttonConfirm = PM_PAGE_AddPushButton(page, rcButton_Confirm, "Confirm", doc);

PM_CANVAS_ShowText(canvas,10, 600,"Info:", 0);

PM_ANNOTATION listBox_Info = PM_PAGE_AddListBox(page, rcListBox_Info, "ListBox_Info", doc);
	
PM_ANNOT_WIDGET_CHOICE_AddItem(listBox_Info, "Value1");
PM_ANNOT_WIDGET_CHOICE_AddItem(listBox_Info, "Value2");
PM_ANNOT_WIDGET_CHOICE_AddItem(listBox_Info, "Value3");

PM_DOCUMENT_Save(doc, "FillableForms.pdf");
PM_DOCUMENT_Free(doc);

PDF Library Download Features Manual Tutorials FAQ Pricing HTML2PDF-X Pilot History In the Lab

 

 

PDF Library | Virtual Printer | Converters to PDF

Support | Blog | Forum | Contacts

© 2000-2012, Two Pilots