3

I am trying to do page break in LWC. But it is not working. Below is the code . How to do page break in lightning while printing the page to pdf.

<template>
    <div>
      <lightning-layout>
        <lightning-layout-item>
          First Page
        </<lightning-layout-item>
      </<lightning-layout>
    </div>
    <div style="page-break-before: always;">
      <lightning-layout>
        <lightning-layout-item>
          Second Page
        </<lightning-layout-item>
      </<lightning-layout>
    </div>
           <lightning-button label="Print" title="print" onclick={printpreview} class="printbutton"></lightning-button>&nbsp;&nbsp;
           <lightning-button label="Back" title="Back to record" onclick={back} class="back"></lightning-button>
        </template>
9
  • I tried your code and can see it work: imgur.com/a/J4nVxUe Commented Jun 20, 2019 at 16:27
  • Please try it in LWC..not in normal HTML compiler.. Commented Jun 20, 2019 at 16:46
  • I literally created a LWC component and embedded in aura app and took screenshot Commented Jun 20, 2019 at 16:47
  • ok then... i am not sure why it is not working for me.. Commented Jun 20, 2019 at 16:47
  • Have you added that compoent in a page or appbuilder? Commented Jun 20, 2019 at 16:48

0

You must log in to answer this question.