Page Break?

Hi there,

I’m having this issue,
I am creating a Contract Template trough PDF Templates, but the thing is that I got TinyMCE Editor and when i insert a page break it shows like it’s ok, but when i save it keeps getting erased, doesn’t stays and the template go crazy.
Anyone any idea why I have this issue or a way to solve it?

Thanks in advance

When you save a PDF template, SuiteCRM will try to filter out a list of html and css that it deem to be unsafe. It looks like page break is one of those items.

A work around is to create a table and set the height to the size of the page you are tageting, then place your content inside the table.

1 Like

Hi Djsamson,

Thanks for your reply.
The idea you gave me it’s pretty good, but the obstacle I have is that I want 6 pages to be printed when I “Print as PDF” the Contract.
Do you know any kind of word around for that?

Thanks in advance.
Kind regards.

The second problem I got is that whenever I try to edit any template or to create a new one and save it, it saves blank (the description field) which should be filled with the tables I did a few days ago, but I don’t know why it’s not showing up now. Any idea?

Thank you very much.
Have a great day

You need to create six tables(one for each page) and set the height and width to the target paper size (bigger or smaller if you need to). In order to prevent any overflow. You also need to set the margins and padding to 0.

Here are a list of the sizes:
‘4A0’ = 4767.87 x 6740.79
‘2A0’ = 3370.39 x 4767.87
‘A0’ = 2383.94 x 3370.39
‘A1’ = 1683.78 x 2383.94
‘A2’ = 1190.55 x 1683.78
‘A3’ = 841.89 x 1190.55
‘A4’ = 595.28 x 841.89
‘A5’ = 419.53 x 595.28
‘A6’ = 297.64 x 419.53
‘A7’ = 209.76 x 297.64
‘A8’ = 147.40 x 209.76
‘A9’ = 104.88 x 147.40
‘A10’ = 73.70 x 104.88
‘B0’ = 2834.65 x 4008.19
‘B1’ = 2004.09 x 2834.65
‘B2’ = 1417.32 x 2004.09
‘B3’ = 1000.63 x 1417.32
‘B4’ = 708.66 x 1000.63
‘B5’ = 498.90 x 708.66
‘B6’ = 354.33 x 498.90
‘B7’ = 249.45 x 354.33
‘B8’ = 175.75 x 249.45
‘B9’ = 124.72 x 175.75
‘B10’ = 87.87 x 124.72
‘C0’ = 2599.37 x 3676.54
‘C1’ = 1836.85 x 2599.37
‘C2’ = 1298.27 x 1836.85
‘C3’ = 918.43 x 1298.27
‘C4’ = 649.13 x 918.43
‘C5’ = 459.21 x 649.13
‘C6’ = 323.15 x 459.21
‘C7’ = 229.61 x 323.15
‘C8’ = 161.57 x 229.61
‘C9’ = 113.39 x 161.57
‘C10’ = 79.37 x 113.39
‘RA0’ = 2437.80 x 3458.27
‘RA1’ = 1729.13 x 2437.80
‘RA2’ = 1218.90 x 1729.13
‘RA3’ = 864.57 x 1218.90
‘RA4’ = 609.45 x 864.57
‘SRA0’ = 2551.18 x 3628.35
‘SRA1’ = 1814.17 x 2551.18
‘SRA2’ = 1275.59 x 1814.17
‘SRA3’ = 907.09 x 1275.59
‘SRA4’ = 637.80 x 907.09
‘LETTER’ = 612.00 x 792.00
‘LEGAL’ = 612.00 x 1008.00
‘LEDGER’ = 279.00 x 432.00
‘TABLOID’ = 279.00 x 432.00
‘EXECUTIVE’ = 521.86 x 756.00
‘FOLIO’ = 612.00 x 936.00
‘B’=362.83 x 561.26
‘A’=314.65 x 504.57
‘DEMY’=382.68 x 612.28
‘ROYAL’=433.70 x 663.30

1 Like

Thanks for the sizes, it has been very helpfull.

The little thing that still trouble me is that i cannot do any template because when I save it and try to edit again it erases all the content and the fields are blank. It may be a permission problem?

Thank you!!!

It is a confirmed bug, please see

https://github.com/salesagility/SuiteCRM/issues/4223

For page break i use this code, from html2pdf (the lib inside generatePDF) :

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

just insert in the HTML code of the template.

don’t know how to change it on the editor to change the code of the “insert page break button…”

Hi,

I am using now suite 7.11.8. Almost everything is good as per my need. But the major and the main problem is I cant take a pdf print with page break. Before this i used 7.6 which has no problem at all. Now please give the solution for the same. because pdf templet cant save the pagebreak…

Apparently, When I save the HTML it removes the pagebreak, like if there is a filter and removes the pagebreak, since it doesn’t appear in the database. If I add the page break directly into the database the PDF behaves as expected.

So, the issue is somewehere in the save process. Someone help us?

using SuiteCRM 7.10.7

Here is a simple solution to fix the pagebreak problem in SuiteCRM which ends up deleting the pagebreak tag when the PDF template is being saved.

Inside data/SugarBean.php

Simply replace

        if (isset($def['type']) && ($def['type'] == 'html' || $def['type'] == 'longhtml')) {
            $this->$key = htmlentities(SugarCleaner::cleanHtml($this->$key, true));

with

        if (isset($def['type']) && ($def['type'] == 'html' || $def['type'] == 'longhtml' || $def['type'] == 'longtext') ) {

            if (strpos($this->$key, 'pagebreak') === false)
            {
                $this->$key = htmlentities(SugarCleaner::cleanHtml($this->$key, true));
            }

Big thank you to Dimitri Golitsin of the ODS team (St-Petersburg, Russia) for figuring it out

This simple elegant fix simply makes sure that the pagebreak does not get removed by the SugarCleaner method

source:
http://qc-digital.com/fix-pagebreak-problem-in-suitecrm/