Summary of steps
To render a rights-enabled form, perform the following tasks:
- Include project files.
- Create a Forms Client API object.
- Set usage rights run-time options.
- Render a rights-enabled form.
- Write the rights-enabled form to the client web browser.
Include project files
Include necessary files into your development project. If you are creating a client application using Java, include the necessary JAR files. If you are using web services, ensure that you include the proxy files.
Create a Forms Client API object
Before you can programmatically perform a Forms service Client API operation, you must create a Forms service client.
Set usage rights run-time options
Set usage rights run-time options to render a rights-enabled form. Specify the alias of the credential that is used to apply usage rights to a form. After you specify the alias value, you specify each usage right to apply to the form.
Render a rights-enabled form
To render a rights-enabled form, you use the same application logic as rendering a form without usage rights. The only difference is that you must ensure that the usage rights run-time options are included in your application logic.
Write the form data stream to the client web browser
When the Forms service renders a rights-enabled form, it returns a form data stream that you must write to the client web browser. Once written to the client web browser, the form is visible to the user. A user viewing the rights-enabled form in Adobe Reader is able to perform operations that are enabled for that form.
See also
Render rights-enabled forms using the Java API
Render rights-enabled forms using the web service API
Including AEM Forms Java library files
Forms Service API Quick Starts
Render rights-enabled forms using the Java API
Render a rights-enabled form by using the Forms API (Java):
-
Include project files
Include client JAR files, such as adobe-forms-client.jar, in your Java project’s class path.
-
Create a Forms Client API object
- Create a
ServiceClientFactory
object that contains connection properties. - Create an
FormsServiceClient
object by using its constructor and passing theServiceClientFactory
object.
- Create a
-
Set usage rights run-time options
- Create a
ReaderExtensionSpec
object by using its constructor. - Specify the alias of the credential by invoking the
ReaderExtensionSpec
object’ssetReCredentialAlias
method and specify a string value that represents the alias value. - Set each usage right by invoking the corresponding method that belongs to the
ReaderExtensionSpec
object. However, you can only set a usage right if the credential that you reference lets you do so. That is, you cannot set a usage right if the credential does not let you set it. For example. to set the usage right that enables a user to fill in form fields and save the form, invoke theReaderExtensionSpec
object’ssetReFillIn
method and passtrue
.
NOTE
It is not necessary to invoke theReaderExtensionSpec
object’ssetReCredentialPassword
method. This method is not used by the Forms service. - Create a
-
Render a rights-enabled form
Invoke the
FormsServiceClient
object’srenderPDFFormWithUsageRights
method and pass the following values:- A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
. - A
com.adobe.idp.Document
object that contains data to merge with the form. If you do not want to merge data, pass an emptycom.adobe.idp.Document
object. - A
PDFFormRenderSpec
object that stores run-time options. - A
ReaderExtensionSpec
object that stores usage rights run-time options. - A
URLSpec
object that contains URI values that are required by the Forms service.
The
renderPDFFormWithUsageRights
method returns aFormsResult
object that contains a form data stream that must be written to the client web browser. - A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
-
Write the form data stream to the client web browser
- Create a
com.adobe.idp.Document
object by invoking theFormsResult
object 'sgetOutputContent
method. - Get the content type of the
com.adobe.idp.Document
object by invoking itsgetContentType
method. - Set the
javax.servlet.http.HttpServletResponse
object’s content type by invoking itssetContentType
method and passing the content type of thecom.adobe.idp.Document
object. - Create a
javax.servlet.ServletOutputStream
object used to write the form data stream to the client web browser by invoking thejavax.servlet.http.HttpServletResponse
object’sgetOutputStream
method. - Create a
java.io.InputStream
object by invoking thecom.adobe.idp.Document
object’sgetInputStream
method. - Create a byte array populate it with the form data stream by invoking the
InputStream
object’sread
method and passing the byte array as an argument. - Invoke the
javax.servlet.ServletOutputStream
object’swrite
method to send the form data stream to the client web browser. Pass the byte array to thewrite
method.
- Create a
Render rights-enabled forms using the web service API
Render a rights-enabled form by using the Forms API (web service):
-
Include project files
- Create Java proxy classes that consume the Forms service WSDL.
- Include the Java proxy classes into your class path.
-
Create a Forms Client API object
Create a
FormsService
object and set authentication values. -
Set usage rights run-time options
- Create a
ReaderExtensionSpec
object by using its constructor. - Specify the alias of the credential by invoking the
ReaderExtensionSpec
object’ssetReCredentialAlias
method and specify a string value that represents the alias value. - Set each usage right by invoking the corresponding method that belongs to the
ReaderExtensionSpec
object. However, you can only set a usage right if the credential that you reference lets you do so. That is, you cannot set a usage right if the credential does not let you set it. To set the usage right that enables a user to fill in form fields and save the form, invoke theReaderExtensionSpec
object’ssetReFillIn
method and passtrue
.
- Create a
-
Render a rights-enabled form
Invoke the
FormsService
object’srenderPDFFormWithUsageRights
method and pass the following values:- A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
Applications/FormsApplication/1.0/FormsFolder/Loan.xdp
. - A
BLOB
object that contains data to merge with the form. If you do not want to merge data with the form, you must pass aBLOB
object that is based on an empty XML data source. You cannot pass aBLOB
object that is null; otherwise, an exception is thrown. - A
PDFFormRenderSpec
object that stores run-time options. - A
ReaderExtensionSpec
object that stores usage rights run-time options. - A
URLSpec
object that contains URI values that are required by the Forms service.
The
renderPDFFormWithUsageRights
method returns aFormsResult
object that contains a form data stream that must be written to the client web browser. - A string value that specifies the form design name, including the file name extension. If you reference a form design that is part of a Forms application, ensure that you specify the complete path, such as
-
Write the form data stream to the client web browser
- Create a
BLOB
object that contains form data by invoking theFormsResult
object’sgetOutputContent
method. - Get the content type of the
BLOB
object by invoking itsgetContentType
method. - Set the
javax.servlet.http.HttpServletResponse
object’s content type by invoking itssetContentType
method and passing the content type of theBLOB
object. - Create a
javax.servlet.ServletOutputStream
object used to write the form data stream to the client web browser by invoking thejavax.servlet.http.HttpServletResponse
object’sgetOutputStream
method. - Create a byte array and populate it by invoking the
BLOB
object’sgetBinaryData
method. This task assigns the content of theFormsResult
object to the byte array. - Invoke the
javax.servlet.http.HttpServletResponse
object’swrite
method to send the form data stream to the client web browser. Pass the byte array to thewrite
method.
- Create a
Experience Manager
Espressos & Experience Manager: AEM Forms
Espressos & Experience Manager
Thursday, Mar 6, 7:00 PM UTC
Join Adobe's AEM product team as they highlight AEM Forms' latest innovations, including: the new Gen AI Assistant, Unified Composition with AEM Sites, and new ways to deploy forms through conversations.
RegisterPut the Customer at the Center and Build Relationships That Last a Lifetime
First impressions last a lifetime. Great first impressions feel personal, connected, and relevant right from the start. From the first...
Wed, Mar 19, 2:30 PM PDT (9:30 PM UTC)
Rapid Feature Releases with AEM Cloud: Telegraph Media Group’s RDE Strategy
Hear how Telegraph Media Group, the award-winning publisher of The Daily Telegraph, The Sunday Telegraph, The Telegraph Magazine,...
Wed, Mar 19, 3:30 PM PDT (10:30 PM UTC)
Connect with Experience League at Summit!
Get front-row access to top sessions, hands-on activities, and networking—wherever you are!
Learn more