Step 2: Configure the Embed PDF Component

Configure the component according to the PDF-generation service you want to use.

PropertyDescription
Adobe PDF Embed API Client IDClient ID used to initialize the Adobe PDF Embed API
PDF Generation EndpointAEM servlet endpoint that generates and returns the PDF
PDF Generation TypeInteractive Communication (IC) or PDF Data Merge
IC Document IDDocument ID of the Interactive Communication
XDP TemplateXDP template used for PDF Data Merge
XML Root ElementXML hierarchy expected by the XDP template
PDF File NameFilename assigned to the generated PDF
Embed ModePDF viewer display mode
Viewer HeightHeight of the PDF viewer in pixels

For Interactive Communications, configure the endpoint:
ic-document

/bin/aem-forms-pdf-embed/generate-ic-pdf

For PDF Data Merge, configure:
data-merge

/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().
generate-pdf
The custom function retrieves the Adaptive Form data:

window.guideBridge.getFormDataObject({
  success: function(resultObj) {
    const formData = JSON.parse(resultObj.data.data);

    window.renderEmbeddedPdf({
      formData
    });
  },
  error: function(error) {
    console.error("Unable to retrieve Adaptive Form data", error);
  }
});

The complete custom function is available in the GitHub repository:

examples/adaptive-forms/generate-embedded-pdf.js

The function performs two operations:

  1. Retrieves the Adaptive Form field values using GuideBridge.
  2. 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:

  1. Reads the PDF-generation configuration specified in its authoring dialog.
  2. Combines the configured document information with the Adaptive Form data.
  3. Constructs the request payload for the selected generation type.
  4. Sends a POST request to the configured AEM servlet endpoint.
  5. Receives the generated PDF as a binary response.
  6. 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.

  1. Enter test values in the Adaptive Form fields.
  2. Click Generate PDF.
  3. Verify that the loading indicator appears.
  4. Confirm that the PDF is generated and displayed inline.
  5. Check the browser Network tab to verify that the configured PDF-generation endpoint returns HTTP 200 with Content-Type: application/pdf.

If PDF generation fails, inspect the browser console and AEM logs to identify the error.

NOTE
The PDF-generation endpoint must authorize access to the requested document and data. This is particularly important when the Adaptive Form is publicly accessible and the IC servlet uses server-side OAuth credentials.

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 event

Ask AI

Not sure where to start?
Ask me anything about Adobe products.

Type your question or pick a suggestion below.

Use of this AI chatbot is subject to Adobe's Privacy Policy. Don't share sensitive data. AI responses are not your Content, may be inaccurate, and any offers provided are non-binding. Generative AI Terms.

Ask AI