Friday, September 7, 2012

PerfectForms – Create and Save Form PDF

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.

  1. Create a Webservices Connection to AP. http://app.perfectforms.com/api/api.asmx
    1. Create a new action for Login. Test it with Username, password and the Security Key. Auto complete the Response.
    2. 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.
  2. Create a webservices connection to your webservice which will take string as Parameter. (I guess you need to create this).
  3. 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
  4. Goto the form that needs to be printed automatically.
    1. Add a helper Text fields for the following.
      1. InstanceID
      2. Form ID = Assign the value that you got in step 2.
      3. Multiline text with max chars as 90,000.
      4. tokenOut
      5. FormPrintSubmit and set its default value to 0.
    2. In the Form Load add simple branch behavior to check if the FormPrintSubmit text is empty or 0.
      1. If true don't do anything.
      2. if its false then have a connect command which points to the API connection that was create in step 1.
        1. Do a set field and choose InstanceID field and the value as instance number from the special dropdown.
        2. In the action command choose Login.
          1. 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.
          2. In the return parameters, choose the tokenout to save the value in tokenout field that you create in Step 3,I,iv.
      3. Add another connection and connect from the above connection to this. Choose the API service on the connection and PDFPrint on the Action.
        1. In the send parameters, choose the tokenin value with the tokenout field.
        2. Assign the formID from the FormID field.
        3. Assign InstanceId from the InstanceID field.
        4. Choose Formula for the section, width and height and set the value in the formula window.
        5. In the return parameters, choose tokenout to be set to tokenout field and pdf value to the pdf multiline text.
      4. Add another connection which will connect to your webservice.
        1. In the send parameters sent the text from the multiline text.
        2. 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.
      5. Now add a behavior close which will close the form.


       

  5. 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.

Saturday, March 17, 2012

Is it my thinking or is it the reality?

My Thought:

Macintosh is a beautiful peace good to have like a pretty girl friend we would like to have around always. Its expensive to buy and maintain and does less work or does not do what we always wanted.

Microsoft is not a pretty one (Not an ugly one though) as Macintosh and it is like a wife who will most of the time support and help you get organised and move up the ladder, Most important, it gives a future and in-expensive to buy or maintain. When there is a problem just buy a good dinner :-) done with $50.