[Zope] RE: html2pdf truncating html content

Jonathan dev101 at magma.ca
Mon Jul 17 10:51:52 EDT 2006

some more wags:

1) remove the html comments from the generated html code (ie. get rid of the <!-- PAGE BREAK --> tags)
2) remove the body loop and hard code in a 1 liner instead eg. body +='some new text' and see what happens
3) where are the <html> and </html> tags added into the html code you pass to html2pdf? (they weren't in the python code you posted)


  ----- Original Message ----- 
  From: Smith, Barrett 
  To: Jonathan ; zope at zope.org 
  Sent: Monday, July 17, 2006 10:39 AM
  Subject: RE: [Zope] RE: html2pdf truncating html content

  Thanks, Jonathan, but no joy.  Testing for the value of of d.title before writing it doesn't change the output and even a hardcoded body+="text goes here" just inside the for loop doesn't get printed.


  From: Jonathan [mailto:dev101 at magma.ca] 
  Sent: Monday, July 17, 2006 10:25 AM
  To: Smith, Barrett; zope at zope.org
  Subject: Re: [Zope] RE: html2pdf truncating html content

  Just a wag (wild assed guess)... in your BODY loop, if d.title is null could you be embedding a 'null' char in the text string, which may cause html2pdf to choke?


    ----- Original Message ----- 
    From: Smith, Barrett 
    To: zope at zope.org 
    Sent: Monday, July 17, 2006 9:30 AM
    Subject: RE: [Zope] RE: html2pdf truncating html content

    Refinement of problem statement:

    The DTML file on which html2pdf is called is populated by a python script which builds and returns html by processing a list of objects in a for loop.  The html content which is missing from the pdf is generated inside the for loop.  As said before though, the information built in the for loop is displayed in the DTML when it is viewed as a webpage.

    The python is below:

    data = [n for n in context.objectValues(['RDMA Narrative','RDMA Indicator']) if n.country==selectedCountry] 


    body+="<h1>%s</h1>\n" % selectedCountry
    body+="<!-- PAGE BREAK -->\n"

    for d in data:
      body+="%s\n" % (d.title)
      if d.meta_type == 'RDMA Indicator':
        if hasattr(d,'xltohtml'):
      elif d.meta_type == 'RDMA Narrative':
        body+="<h3>%s</h3>" % d.narrativeType
      body+="<!-- PAGE BREAK -->\n"

    return body

    From: zope-bounces+bsmith=constellagroup.com at zope.org [mailto:zope-bounces+bsmith=constellagroup.com at zope.org] On Behalf Of Smith, Barrett
    Sent: Monday, July 17, 2006 9:14 AM
    To: zope at zope.org
    Subject: [Zope] RE: html2pdf truncating html content

    I'm using html2pdf and it seems to be truncating the content.  The html on which html2pdf is:

    <head><title>Narrative Report</title></head>

    <!-- PAGE BREAK -->
    <h2>Narrative: PNG- Challenge Situation</h2>
    <!-- PAGE BREAK -->
    <h2>Narrative: PNG- Key Accomplishments</h2>
    <!-- PAGE BREAK -->
    <h2>Narrative: PNG- Program Performance</h2>

<!-- PAGE BREAK -->
<h2>Narrative: PNG- Success Stories</h2>
<!-- PAGE BREAK -->
<h2>Table 1-2 PNG</h2>
<!-- PAGE BREAK -->
<h2>Table 1-4 PNG</h2>
<!-- PAGE BREAK -->
<h2>Narrative: PNG- Annex II</h2>
<!-- PAGE BREAK -->
<h2>Narrative: PNG- Annex III</h2>
<!-- PAGE BREAK -->

The html which html2pdf is writing to the pdf though is:<html><head><title>Narrative Report</title></head><body><h1>PNG</h1><!-- PAGE BREAK --></body></html>I'm at a loss to explain the truncation.  Can anyone offer some suggestions?


    Zope maillist  -  Zope at zope.org
    **   No cross posts or HTML encoding!  **
    (Related lists - 
     http://mail.zope.org/mailman/listinfo/zope-dev )
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/zope/attachments/20060717/ebbbf6bf/attachment-0001.htm

More information about the Zope mailing list