How to add blank page at the end of the native pdf document using javascript in AEM Guides | Community
Skip to main content
Level 2
November 21, 2023
Solved

How to add blank page at the end of the native pdf document using javascript in AEM Guides

  • November 21, 2023
  • 1 reply
  • 2325 views

Hi All,

I'm trying to create PDF document using AEM guides. i have frontcover, some topics and backcover in PDF. I need to add one blank page at the end of the pdf document using javascript. Is anyone having idea, how to achieve this?

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

Thanks, @vivekkumar. This solution is working fine for static logic. but I need to get the overall count pages in PDF. Based on the pdf page count, need to add blank pages dynamically using javascript in AEM Guides.


Hi @kiruthika_r ,

You can insert an empty div element at the end of the document and set the style property to page-break-before: always; See example below

var newPage = document.createElement("div"); newPage.setAttribute("style", "page-break-before: always;") document.body.append(newPage);

You can add your custom logic around this code to achieve the desired result.

 

1 reply

Adobe Employee
November 21, 2023

You can achieve this without JavaScript. What is the AEM version you are on?

Level 2
November 22, 2023

I'm using AEM version 6.5.18.

Do you have any idea how to implement the blank page creation in PDF using javascript in AEM Guides?

Adobe Employee
November 22, 2023

I meant to ask AEM Guides version, my bad. Can you please quickly share that?