Expand my Community achievements bar.

Radically easy to access on brand approved content for distribution and omnichannel performant delivery. AEM Assets Content Hub and Dynamic Media with OpenAPI capabilities is now GA.

Print one page or Print current page

Avatar

Former Community Member
Hi



I have a form which grows in page numbers.

I want users to be able to print out one page (or print current page)



I have tried using the Print button that comes default with the software.

xfa.host.print(1, "7", (xfa.host.numPages -7).toString(), 0, 1, 0, 0, 0);



This works unless i add more instances of a field, which adds more pages to the form. This results in the wrong page being printed.



Is there a way that i can target one specific subform to be printed?

Or to print the current page using the Print button? without having to go to File - Print - current page?



This is how i've set the page i want to be printed.

form1.quotation.quotationNew



any help would be greatly appreciated

Thanks
3 Replies

Avatar

Former Community Member
Hi again,

Can anyone please help me with this?

I just want to be able to call on a function which allows the user to print the current page instead of the whole form.

Is this possible?

Thanks

Avatar

Former Community Member
Hi,



if it is not too late, try this:



var nTemplatePage = 0; // this is the page as seen in the designer, before rendering.



var nRenderedPage = xfa.layout.page(xfa.form.participant_document.FlowPage.all.item(nTemplatePage));



nPageSpan = xfa.layout.pageSpan(xfa.form.participant_document.FlowPage.all.item(nTemplatePage));



nRenderedPage will be the new page number after rendering.

nPageSpan will be the number of pages the nTemplatePage spans to.



then, just put the nRenderedPage into your print as the two page parameters.



I have this code in a button on the pdf that I use for printing.



hope that helps,

John

Avatar

Former Community Member
Hi John,

Thanks for the reply.

Am i supposed to modify any of that to my own form?

because that didn't work for me.



When i add more instances to one of my questions, it creates more pages, so when i click on print - it doesn't print the current page.



any ideas?

Thanks