AEM 6.5 HTML5 form -printing visible pages | Community
Skip to main content
Level 5
December 12, 2023

AEM 6.5 HTML5 form -printing visible pages

  • December 12, 2023
  • 1 reply
  • 2457 views

Hi,

I have a XDP form that has 3 pages. When this form is rendered as HTML5, it is set to have only the main first page visible and the remaining 2 pages as hidden (exclude from layout). When a check box is clicked in the main page then the remaining 2 pages become visible and allow the user to enter the data. This works until the data is filled in. 

But when trying to print/save as static PDF, only the main/first page is printed, but not the reset of the pages. I tried the following JavaScript code but the +print is not having any effect.

this.resolveNode("form1.page2").presence = "visible";
this.resolveNode("form1.page2").relevant = "+print";

Any suggestion on how to fix this?

Thanks,

Leena

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Vijay_Katoch
Community Advisor
Community Advisor
December 13, 2023

Can you please share your form to look into?

Level 5
December 13, 2023

Hi Vijay,

Is there an email address to which I can send it to?

Thanks,

Leena

Level 5
January 4, 2024

Hi Vijay,

In the AEM CRX, the sling:resourceType uses /content/profiles/ to render the XDP as HTML5 form. In the URL all the buttons, checkboxes etc., and events work in the form. Only after the form is filled in and submitted is the data transferred as XML to the AEM server where the code uses the data, form template and outputService.generatePDFOutput() service to generate the static PDF and sends it to the browser. 

I have attached PrintIssue_v2.pdf to this post. I am able to view the XDP version of this PrintIssue_v2.pdf in the Designer's 'Preview HTML' tab. On clicking the 'G M' checkbox in the main page, the second page is displayed as a separate page. After uploading the XDP template in the AEM server and viewing it from the URL, the same form displays both the pages when clicking the checkbox. But looks like the second page is not in a separate content Area since it appears to be continuing from the main page. On clicking the submit button only the first/main page is saved as static PDF, it does not include the second page in the static PDF.

The only issue now is that the second page is not saved/printed/visible in the generated static PDF.

Thanks,

Leena

 


Hi,

I redesigned the XDP form by moving the contents from the second bode page to a second master page. Created flowed second page with positioned sub form. Both the second body page and subform are in the content area of the second master page. The form is working as expected when the check box is clicked to display the second page. But now even when the second page is hidden when the checkbox is unchecked, it gets printed/saved as static PDF. This may be because the contents are in the second master page. How do I hide the contents in the master page from being printed/saved as static PDF? 

I tried both "invisible' and "hidden" values but the second page still gets printed/saved as static PDF.

this.resolveNode("form.#pageSet[0].Page2").presence = "invisible";

xfa.resolveNode("form.#pageSet[0].Page2").presence = "hidden"; 

The second page should not print when the checkbox is unchecked.

Any suggestions?