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 Submit and Reset Form Actions

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 rcRadioButton1 = {10,740,30,760};
PM_RECT rcRadioButton2 = {10,720,30,740};
PM_RECT rcButton_Submit = {10,650,105,680};
PM_RECT rcButton_Reset = {115,650,210,680};
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 radioButton1 = PM_PAGE_AddRadioButton(page, rcRadioButton1, "RadioButton1", doc);
PM_ANNOT_WIDGET_RADIOBUTTON_SetChecked(radioButton1, true);
PM_CANVAS_ShowText(canvas,40, 750,"Value 1", 0);

PM_ANNOTATION radioButton2 = PM_PAGE_AddRadioButton(page, rcRadioButton2, "RadioButton2", doc);
PM_CANVAS_ShowText(canvas,40, 730,"Value 2", 0);

PM_ANNOTATION buttonSubmit = PM_PAGE_AddPushButton(page, rcButton_Submit, "Submit", doc);
PM_ANNOTATION buttonReset = PM_PAGE_AddPushButton(page, rcButton_Reset, "Reset", doc);

PM_ACTION resetAction = PM_DOCUMENT_AddResetFormAction(doc);
PM_ACTION_RESETFORM_AddField(resetAction, editBoxName);
PM_ACTION_RESETFORM_AddField(resetAction, radioButton1);
PM_ACTION_RESETFORM_AddField(resetAction, radioButton2);
PM_ANNOT_WIDGET_SetOnActivatedAction(buttonReset, resetAction);

PM_ACTION submitAction = PM_DOCUMENT_AddSubmitFormAction(doc, "http://pdfmosaic.com/login");

// PM_SUBMIT_FORMAT:
// sfHTML = 1
// sfFDF  = 2
// sfXFDF = 3
// sfPDF  = 4
PM_ACTION_SUBMITFORM_SetSubmitFormat(submitAction, sfHTML);

// PM_SUBMIT_METHOD
// smGet = 1,
// smPost = 2
PM_ACTION_SUBMITFORM_SetSubmitMethod(submitAction, smGet);

PM_ACTION_RESETFORM_AddField(submitAction, editBoxName);
PM_ACTION_RESETFORM_AddField(submitAction, radioButton1);
PM_ACTION_RESETFORM_AddField(submitAction, radioButton2);
PM_ANNOT_WIDGET_SetOnActivatedAction(buttonSubmit, submitAction);

PM_DOCUMENT_Save(doc, "SubmitResetFormActions.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