Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.

Unable to get renderPDFForm() function on FormsService - Rendering on ASP.NET Applications

Avatar

Level 1

Hello,

We are trying to acheive the following(Attached full PDF)

  1. A user requests that the loan application be rendered to the web browser.
  2. The ASP.NET application invokes the Forms ES service using a web service and renders an interactive form to the client web browser.
  3. After the user fills the loan form and clicks the submit button, data is submitted back to the ASP.NET application. The ASP.NET application processes the      form submission and retrieves form data (the data that the user entered into the form).
  4. A confirmation form is rendered back to the web browser. Data such as the user’s first and last name is merged with the form before it is rendered.

We have installed

1. Adobe LiveCycle designer ES 4.

2. Also we have installed Adobe LiveCycle work bench.

But we are unable to create the Formservice.cs Also we dont have the methods and properties such as renderPDFForm(parameters) etc..

can anyone help us on getting this done?

Best Regards,

Prasanth.k

2 Replies

Avatar

Level 1

http://www.adobe.com/content/dam/Adobe/en/devnet/livecycle/pdfs/ASP-NET.pdf

i am not getting the point how to create the web serice and its mothods. is there a predefined webservice

I am trying to implement interactive forms using Adobe forms in .NET

Where can I find the below highlighted web service and it methods.

???using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.ServiceModel;

using System.IO;

using RenderPDFForm.ServiceReference1;

namespace RenderPDFForm

{

       class Program

       {

           static void Main(string[] args)

           {

               try

               {

                   //Create a FormsServiceClient object

                  FormsServiceClient formsClient = new FormsServiceClient();

                   formsClient.Endpoint.Address = new System.ServiceModel.EndpointAddress("http://hiro-xp:8080/soap/services/FormsService?blob=mtom");

                   //Enable BASIC HTTP authentication

                   BasicHttpBinding b = (BasicHttpBinding)formsClient.Endpoint.Binding;

                   b.MessageEncoding = WSMessageEncoding.Mtom;

                   formsClient.ClientCredentials.UserName.UserName = "administrator";

                   formsClient.ClientCredentials.UserName.Password = "password";

                   b.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic;

                   b.Security.Mode = BasicHttpSecurityMode.TransportCredentialOnly;

                   b.MaxReceivedMessageSize = 2000000;

                   b.MaxBufferSize = 2000000;

                   b.ReaderQuotas.MaxArrayLength = 2000000;

                   //Reference the XDP document to render

                   string inputFileName = "C:\\Adobe\Loan.xdp";

                   FileStream fs = new FileStream(inputFileName, FileMode.Open);

                   //Get the length of the file stream 

                   int len = (int)fs.Length;

                   byte[] ByteArray = new byte[len];

                   //Populate the byte array with the contents of the FileStream object

                   fs.Read(ByteArray, 0, len);

                   BLOB inDoc = new BLOB();

                   inDoc.MTOM = ByteArray;

    

                   //Set run-time options

                   PDFFormRenderSpec renderSpec = new PDFFormRenderSpec();

                   renderSpec.generateServerAppearance = true;

                   //Set out parameter values

                   long pageCount = 1;

                   String localeValue = "en_US";

                   FormsResult result = new FormsResult();

                   //Render an interactive PDF form by ivoking the renderPDFForm2 method

                   formsClient.renderPDFForm2(

                       inDoc,

                       null,

                       renderSpec,

                       null,

                       null,

                       out pageCount,

                       out localeValue,

                       out result);

                   //Populate a byte array with BLOB data

                   RenderPDFForm.ServiceReference1.BLOB outDoc = result.outputContent;

                   byte[] outByteArray = outDoc.MTOM;

                   //Save the interactive form as a PDF file

                   string fileName = "C:\\Adobe\Loan.pdf";

                   FileStream fs2 = new FileStream(fileName, FileMode.OpenOrCreate);

                   //Create a BinaryWriter object

                   BinaryWriter w = new BinaryWriter(fs2);

                   w.Write(outByteArray);

                   w.Close();

                   fs2.Close();

               }

               catch (Exception ee)

               {

                   Console.WriteLine(ee.Message);

               }

           }

       }

}

Best Regards,

prasanth.k