Getting Form Printed to PDF and Storing in DB or File System.
http://app.perfectforms.com/api/api.asmx?op=GetFormInstancePDF
Here is the process to get this accomplished.
- Create a Webservices Connection to AP. http://app.perfectforms.com/api/api.asmx
- Create a new action for Login. Test it with Username, password and the Security Key. Auto complete the Response.
- Create a new action for GetFormInstancePDF. Test it and pass in the parameters. Token from the previous login test response, Form ID (how to get it is stated in point 2 below, Specify the width and Height in inches (Typlical 600 by 600 Pixel would be 8 by 8 inches), instanceID as 1 (assuming you have at-least 1 form submitted), section would be complete. You can find the documentation here: http://www.perfectforms.com/Documentation/manual/html/fg_getforminstancepdf.htm , once you test it, do the auto complete on the response.
- Create a new action for Login. Test it with Username, password and the Security Key. Auto complete the Response.
- Create a webservices connection to your webservice which will take string as Parameter. (I guess you need to create this).
- Get the Form ID of the form that needs to be printed. You can get it from the API URL of the form, see below. The highlighted one in the URL is the Form ID. http://app.perfectforms.com/api/forms/3yjHAlggAggA-gwM_API_Add_Instace.asmx
- Goto the form that needs to be printed automatically.
- Add a helper Text fields for the following.
- InstanceID
- Form ID = Assign the value that you got in step 2.
- Multiline text with max chars as 90,000.
- tokenOut
- FormPrintSubmit and set its default value to 0.
- InstanceID
- In the Form Load add simple branch behavior to check if the FormPrintSubmit text is empty or 0.
- If true don't do anything.
- if its false then have a connect command which points to the API connection that was create in step 1.
- Do a set field and choose InstanceID field and the value as instance number from the special dropdown.
- In the action command choose Login.
- In the send parameters – choose formula for all and have the userid, password and Security key entered for each field in the formula window which will pop when you double click on the source against the field.
- In the return parameters, choose the tokenout to save the value in tokenout field that you create in Step 3,I,iv.
- In the send parameters – choose formula for all and have the userid, password and Security key entered for each field in the formula window which will pop when you double click on the source against the field.
- Do a set field and choose InstanceID field and the value as instance number from the special dropdown.
- Add another connection and connect from the above connection to this. Choose the API service on the connection and PDFPrint on the Action.
- In the send parameters, choose the tokenin value with the tokenout field.
- Assign the formID from the FormID field.
- Assign InstanceId from the InstanceID field.
- Choose Formula for the section, width and height and set the value in the formula window.
- In the return parameters, choose tokenout to be set to tokenout field and pdf value to the pdf multiline text.
- In the send parameters, choose the tokenin value with the tokenout field.
- Add another connection which will connect to your webservice.
- In the send parameters sent the text from the multiline text.
- In your webservices it has to convert it as file with pdf extension and then you can save it or send it to another service.
- In the send parameters sent the text from the multiline text.
- Now add a behavior close which will close the form.
- If true don't do anything.
- in the Button which submits the form choose to re-open the same instance once submitted. Before that add a set field which will set the value 1 to FormPrintSubmit. This will trigger the PDF creation.
Let me know if this is clear enough to get things done.