CFHTMLtoPDF - page breaking

Explorer ,
Jul 13, 2015 Jul 13, 2015

Copy link to clipboard

Copied

I am attempting to force a page break in my PDF and not having any luck, wondering if anyone have an suggestions that might help.

<cfhtmltopdf marginBottom="1"

     marginLeft="1"

     marginRight="1"

     marginTop="1"

     orientation="portrait"

     pageType="letter"

     saveAsName="PersonsName">

    <cfinclude template="/dsp_create_pdf.cfm">

</cfhtmltopdf>

dsp_create_pdf.cfm contains a loop and I want to add a Page Break before each title header (to Keep it simple).

BUT reading documentation on cfhtmltopdfitem reads:

pagebreak: can be used to insert a pagebreak in the generated PDF. When <cfhtmltopdf> is used as a service, pagebreak will not work


We WANT to us cfhtmltopdf as a service, so how is this accomplished.


CSS with <p style="page-break-before: always"> </p> DOES NOT work either.


dsp_create_pdf.cfm:


<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">

<head>

    <title>My PDF wihout page breaks</title>

    <cfoutput>

    </cfoutput>

    <style type="text/css">

        .pdf

        {

           font-size:18pt;

           font-family:"Times New Roman";

        }

    </style>

</head>

<!--- get my data --->

<cfinclude template="qry_websrg70.cfm">

<body>

<div class="pdf" align="center">

  <table>

  <tr>

  <td align="center" colspan="3">

  Title

  </td>

  </tr>

  <tr>

  <td align="center" colspan="3">

  <cfoutput>

     #PersonsName#

                </cfoutput>

  </td>

  </tr>

  <tr>

  <td align="center" colspan="3">

  <cfoutput>

     #NOW()#

  </cfoutput>

  </td>

  </tr>

  <tr>

  <td align="center" colspan="3">

   

  </td>

  </tr>

  <cfoutput query="qLetter">

            <cfswitch expression="#CONTENT_IND#">

                <cfcase value="GRDIST">

                <tr>

                    <td align="left" colspan="3">

                    <!---Page Break here--->

                        <!---<cfhtmltopdfitem type="pagebreak" />--->

  <p style="page-break-before: always"> </p>

                    </td>

                </tr>

               </cfcase>

            </cfswitch>

  <tr>

  <td align="left">

  <u>#data1#</u>

  </td>

  </tr>

  <tr>

  <td align="left" colspan="3">

                #l_comments#

  </td>

  </tr>

  <tr>

  <td align="center" colspan="3">

   

  </td>

  </tr>

  </cfoutput>

  </table>

</div>

</body>

</html>

Views

2.2K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Explorer , Aug 12, 2016 Aug 12, 2016
Solution to problem ended up being removing all Table tags from the file dsp_create_pdf.cfm.So only <DIV> <P> were used in the HTML of the CFM page and all worked as expected.

Likes

Translate

Translate
Adobe Employee ,
Jul 16, 2015 Jul 16, 2015

Copy link to clipboard

Copied

Hi Matthew, are you using ColdFusion 11? Could you please tell me which update level is the ColdFusion server running on?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 16, 2015 Jul 16, 2015

Copy link to clipboard

Copied

We are using Update 5 on ColdFusion 11 presently.

I am thinking the issue is about the TABLE structure in my HTML and that I may have to re-write it to use HTML 5 and only use the supported HTML 5 tags that I have read are only supported.

But I am open to other suggestions.  That seems like it might take some effort.  I only am showing part of what the whole deal it doing.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
Jul 16, 2015 Jul 16, 2015

Copy link to clipboard

Copied

Have you registered any pdf services in admin console of ColdFusion? If yes, then does it show any error when clicked on verify connections?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 16, 2015 Jul 16, 2015

Copy link to clipboard

Copied

PDF service is registered in admin and no errors when verifying connection. 

Just misplaced page breaks all works as expected.  PDF comes out just not as expected.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 12, 2016 Aug 12, 2016

Copy link to clipboard

Copied

LATEST

Solution to problem ended up being removing all Table tags from the file dsp_create_pdf.cfm.

So only <DIV> <P> were used in the HTML of the CFM page and all worked as expected.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines