I need to open a pdf preview of my offer generated by a custom button on opportunity page.

[![enter image description here][1]][1]

Currently this works as normal html page, but my problem is that I am not able to manage page interruptions.

enter image description here

In preview mode you can edit some fields

enter image description here

HTML code:

                page[size="A4"] {  
                  width: 21cm;
                  height: 29.7cm;

                page {
                  font-family: "Arial";
                  font-size: 12pt;
                  letter-spacing: 1px;
                  background: white;
                  display: block;
                  margin: auto;
                  margin-bottom: 0.5cm;
                  box-shadow: 0 0 0.5cm rgba(0,0,0,0.5);
                  line-height: 150%;
    <page size="A4">
    Page 1 ...some text here...

    <page size="A4">
    Page 2...some text here...

How to divide the text into separate pages? Any way to solve this?

1 Answer 1


I've used the below styling to manage page breaks in the past when generating a PDF from a VF page. This will create a page break after the div.

<div style="page-break-after:always;" />

Check out below link for other properties you could use: https://www.w3schools.com/cssref/pr_print_pageba.asp

  • Yes, I know this tag and I've used to print my pdf. My issue here is that in this preview the text is contained in each <page> tag
    – Daniele
    Jun 30, 2017 at 7:27
  • Why are you using a page tag? Could you provide more code? I'm not able to recreate this.
    – Adam M
    Jul 1, 2017 at 18:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .