Step 2: Configure the Embed PDF Component
Configure the component according to the PDF-generation service you want to use.
| Property | Description |
|---|---|
| Adobe PDF Embed API Client ID | Client ID used to initialize the Adobe PDF Embed API |
| PDF Generation Endpoint | AEM servlet endpoint that generates and returns the PDF |
| PDF Generation Type | Interactive Communication (IC) or PDF Data Merge |
| IC Document ID | Document ID of the Interactive Communication |
| XDP Template | XDP template used for PDF Data Merge |
| XML Root Element | XML hierarchy expected by the XDP template |
| PDF File Name | Filename assigned to the generated PDF |
| Embed Mode | PDF viewer display mode |
| Viewer Height | Height of the PDF viewer in pixels |
For Interactive Communications, configure the endpoint:
/bin/aem-forms-pdf-embed/generate-ic-pdf
For PDF Data Merge, configure:
/bin/aem-forms-pdf-embed/merge-pdf
These paths assume that the supporting servlets have been deployed using the paths supplied in the GitHub sample.
Step 3: Capture Data Using Adaptive Form Fields
Create an Adaptive Form containing the fields required by your document-generation service.
For example, an Interactive Communication might require a userId or email parameter to retrieve data through its configured Form Data Model.
The Adaptive Form captures the values entered by the user.
The Embed PDF component does not read individual Adaptive Form fields directly. Instead, a custom function retrieves the form data using GuideBridge and passes it to the component.
Step 4: Configure the Generate PDF Button
Add a button labeled Generate PDF to the Adaptive Form.
Configure the button’s Click event to invoke the custom function generateEmbeddedPdf().
The custom function retrieves the Adaptive Form data:
The complete custom function is available in the GitHub repository:
examples/adaptive-forms/generate-embedded-pdf.js
The function performs two operations:
- Retrieves the Adaptive Form field values using GuideBridge.
- Invokes
window.renderEmbeddedPdf()to initiate PDF generation and display.
The custom function does not call the PDF-generation servlet directly.
Step 5: How the Embed PDF Component Processes the Request
When window.renderEmbeddedPdf() is invoked, the component:
- Reads the PDF-generation configuration specified in its authoring dialog.
- Combines the configured document information with the Adaptive Form data.
- Constructs the request payload for the selected generation type.
- Sends a POST request to the configured AEM servlet endpoint.
- Receives the generated PDF as a binary response.
- Uses the Adobe PDF Embed API to display the PDF inline.
For Interactive Communications, the request includes the configured Document ID and the captured form data.
For PDF Data Merge, the request includes the configured XDP template, XML root element, and captured form data.
The supporting servlet performs the actual document generation.
Step 6: Display the Generated PDF
When the user clicks Generate PDF, a loading indicator appears while the document is generated.
Once the servlet returns the PDF, the Embed PDF component initializes the Adobe PDF Embed API and displays the document inline.
The generated PDF appears in the location where the component was added, whether that is an AEM Sites page containing the Adaptive Form or a supported Adaptive Form layout.
[Insert screenshot: Adaptive Form with Generate PDF button and embedded PDF preview]
Step 7: Verify the Integration
Preview or publish the page containing the Adaptive Form and Embed PDF component.
- Enter test values in the Adaptive Form fields.
- Click Generate PDF.
- Verify that the loading indicator appears.
- Confirm that the PDF is generated and displayed inline.
- Check the browser Network tab to verify that the configured PDF-generation endpoint returns HTTP
200withContent-Type: application/pdf.
If PDF generation fails, inspect the browser console and AEM logs to identify the error.
More help on this topic
Was this content helpful?
Announcements
Get hands-on with agentic AI.
Explore how AI agents work together through real examples and hands-on practice. Join your local User Group to design an agent workflow with your peers and leave with a practical framework you can apply to your own work.
Find an eventAdobe Experience Manager Roadmap Webinar, Part 2 (Forms, Cloud & Managed Services) - Americas & EMEA
Preview the AEM Forms, Cloud, and Managed Services roadmap. Ask the team live.
Adobe Experience Manager Roadmap Webinar, Part 2 (Forms, Cloud & Managed Services) - Americas & APAC
Preview the AEM Forms, Cloud, and Managed Services roadmap. Ask the team live.