<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2912" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV dir=ltr align=left><SPAN class=563272016-17072006><FONT face=Arial 
color=#0000ff size=2>Found the problem:&nbsp; context was changing.&nbsp; When 
called from html2pdf, the parent object was different from when the dtml was 
called raw.</FONT></SPAN></DIV><BR>
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> Jonathan [mailto:dev101@magma.ca] 
<BR><B>Sent:</B> Monday, July 17, 2006 10:52 AM<BR><B>To:</B> Smith, Barrett; 
zope@zope.org<BR><B>Subject:</B> Re: [Zope] RE: html2pdf truncating html 
content<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV><FONT face=Arial size=2>some more wags:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>1) remove the html comments from the generated html 
code (ie. get rid of the &lt;!-- PAGE BREAK --&gt; tags)</FONT></DIV>
<DIV><FONT face=Arial size=2>2) remove the body loop and hard code in a 1 liner 
instead&nbsp;eg. body +='some new text' and see what happens</FONT></DIV>
<DIV><FONT face=Arial size=2>3) where are the &lt;html&gt; and &lt;/html&gt; 
tags added into the html code you pass to html2pdf? (they weren't in the python 
code you posted)</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>Jonathan</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
  <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=bsmith@constellagroup.com 
  href="mailto:bsmith@constellagroup.com">Smith, Barrett</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=dev101@magma.ca 
  href="mailto:dev101@magma.ca">Jonathan</A> ; <A title=zope@zope.org 
  href="mailto:zope@zope.org">zope@zope.org</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, July 17, 2006 10:39 
AM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [Zope] RE: html2pdf 
  truncating html content</DIV>
  <DIV><BR></DIV>
  <DIV dir=ltr align=left><SPAN class=213093714-17072006><FONT face=Arial 
  color=#0000ff size=2>Thanks, Jonathan, but no joy.&nbsp; 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.</FONT></SPAN></DIV>
  <DIV dir=ltr align=left><SPAN class=213093714-17072006><FONT face=Arial 
  color=#0000ff size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV dir=ltr align=left><SPAN class=213093714-17072006><FONT face=Arial 
  color=#0000ff size=2>Barrett</FONT></SPAN></DIV><BR>
  <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
  <HR tabIndex=-1>
  <FONT face=Tahoma size=2><B>From:</B> Jonathan [mailto:dev101@magma.ca] 
  <BR><B>Sent:</B> Monday, July 17, 2006 10:25 AM<BR><B>To:</B> Smith, Barrett; 
  <A href="mailto:zope@zope.org">zope@zope.org</A><BR><B>Subject:</B> Re: [Zope] 
  RE: html2pdf truncating html content<BR></FONT><BR></DIV>
  <DIV></DIV>
  <DIV><FONT face=Arial size=2>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?</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <DIV><FONT face=Arial size=2>Jonathan</FONT></DIV>
  <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
  <BLOCKQUOTE 
  style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
    <DIV style="FONT: 10pt arial">----- Original Message ----- </DIV>
    <DIV 
    style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
    <A title=bsmith@constellagroup.com 
    href="mailto:bsmith@constellagroup.com">Smith, Barrett</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>To:</B> <A title=zope@zope.org 
    href="mailto:zope@zope.org">zope@zope.org</A> </DIV>
    <DIV style="FONT: 10pt arial"><B>Sent:</B> Monday, July 17, 2006 9:30 
    AM</DIV>
    <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: [Zope] RE: html2pdf 
    truncating html content</DIV>
    <DIV><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><BR></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>Refinement of problem 
statement:</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>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.&nbsp; <SPAN class=519452413-17072006><FONT 
    face=Arial color=#0000ff size=2>The html content which is missing from the 
    pdf is generated inside the for loop.&nbsp; As said before though, the 
    information built in the for loop is displayed in the DTML when it is viewed 
    as a webpage.</FONT></SPAN></SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006><SPAN 
    class=519452413-17072006></SPAN></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>The python is below:</SPAN></FONT></DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006></SPAN></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>data = [n for n in context.objectValues(['RDMA 
    Narrative','RDMA Indicator']) if n.country==selectedCountry] 
    </SPAN></FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>body=""</SPAN></FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>##TITLE PAGE<BR>body+="&lt;h1&gt;%s&lt;/h1&gt;\n" % 
    selectedCountry<BR>body+="&lt;!-- PAGE BREAK --&gt;\n"</SPAN></FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>##BODY<BR>for d in data:<BR>&nbsp; body+="%s\n" % 
    (d.title)<BR>&nbsp; if d.meta_type == 'RDMA 
    Indicator':<BR>&nbsp;&nbsp;&nbsp; if 
    hasattr(d,'xltohtml'):<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
    body+=d.xltohtml()<BR>&nbsp; elif d.meta_type == 'RDMA 
    Narrative':<BR>&nbsp;&nbsp;&nbsp; body+="&lt;h3&gt;%s&lt;/h3&gt;" % 
    d.narrativeType<BR>&nbsp;&nbsp;&nbsp; body+=d.narrativeText<BR>&nbsp; 
    body+="&lt;!-- PAGE BREAK --&gt;\n"</SPAN></FONT></DIV>
    <DIV>&nbsp;</DIV>
    <DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN 
    class=519452413-17072006>return body</SPAN></FONT></DIV>
    <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial color=#0000ff size=2></FONT>&nbsp;</DIV>
    <DIV><SPAN class=519452413-17072006><FONT face=Arial color=#0000ff 
    size=2></FONT></SPAN>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2></FONT><FONT face=Arial 
size=2></FONT><BR></DIV>
    <DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
    <HR tabIndex=-1>
    <FONT face=Tahoma size=2><B>From:</B> 
    zope-bounces+bsmith=constellagroup.com@zope.org 
    [mailto:zope-bounces+bsmith=constellagroup.com@zope.org] <B>On Behalf Of 
    </B>Smith, Barrett<BR><B>Sent:</B> Monday, July 17, 2006 9:14 
    AM<BR><B>To:</B> zope@zope.org<BR><B>Subject:</B> [Zope] RE: html2pdf 
    truncating html content<BR></FONT><BR></DIV>
    <DIV></DIV>
    <DIV dir=ltr align=left><SPAN class=070215912-17072006><FONT face=Arial 
    size=2>I'm using html2pdf and it seems to be truncating the content.&nbsp; 
    The html on which html2pdf is:</FONT></SPAN></DIV>
    <DIV><SPAN class=070215912-17072006></SPAN>&nbsp;</DIV>
    <DIV><SPAN class=070215912-17072006>&lt;<SPAN 
    class=start-tag>html</SPAN>&gt;<BR>&lt;<SPAN 
    class=start-tag>head</SPAN>&gt;&lt;<SPAN 
    class=start-tag>title</SPAN>&gt;Narrative Report&lt;/<SPAN 
    class=end-tag>title</SPAN>&gt;&lt;/<SPAN 
    class=end-tag>head</SPAN>&gt;<BR>&lt;<SPAN 
    class=start-tag>body</SPAN>&gt;<BR><BR><BR>&lt;<SPAN 
    class=start-tag>h1</SPAN>&gt;PNG&lt;/<SPAN 
    class=end-tag>h1</SPAN>&gt;<BR><SPAN class=comment>&lt;!-- PAGE BREAK 
    --&gt;</SPAN><BR>&lt;<SPAN class=start-tag>h2</SPAN>&gt;Narrative: PNG- 
    Challenge Situation&lt;/<SPAN class=end-tag>h2</SPAN>&gt;<BR><SPAN 
    class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN><BR>&lt;<SPAN 
    class=start-tag>h2</SPAN>&gt;Narrative: PNG- Key Accomplishments&lt;/<SPAN 
    class=end-tag>h2</SPAN>&gt;<BR><SPAN class=comment>&lt;!-- PAGE BREAK 
    --&gt;</SPAN><BR>&lt;<SPAN class=start-tag>h2</SPAN>&gt;Narrative: PNG- 
    Program Performance&lt;/<SPAN class=end-tag>h2</SPAN>&gt;<BR></DIV>
    <DIV><PRE id=line13><SPAN class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN>
&lt;<SPAN class=start-tag>h2</SPAN>&gt;Narrative: PNG- Success Stories&lt;/<SPAN class=end-tag>h2</SPAN>&gt;
<SPAN class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN>
&lt;<SPAN class=start-tag>h2</SPAN>&gt;Table 1-2 PNG&lt;/<SPAN class=end-tag>h2</SPAN>&gt;
<SPAN class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN>
&lt;<SPAN class=start-tag>h2</SPAN>&gt;Table 1-4 PNG&lt;/<SPAN class=end-tag>h2</SPAN>&gt;
<SPAN class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN>
&lt;<SPAN class=start-tag>h2</SPAN>&gt;Narrative: PNG- Annex II&lt;/<SPAN class=end-tag>h2</SPAN>&gt;
<SPAN class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN>
&lt;<SPAN class=start-tag>h2</SPAN>&gt;Narrative: PNG- Annex III&lt;/<SPAN class=end-tag>h2</SPAN>&gt;
<SPAN class=comment>&lt;!-- PAGE BREAK --&gt;</SPAN>

</PRE><PRE id=line25>&lt;/<SPAN class=end-tag>body</SPAN>&gt;
&lt;/<SPAN class=end-tag>html</SPAN>&gt;
</PRE><PRE><SPAN class=070215912-17072006>The html which html2pdf is writing to the pdf though is:</SPAN></PRE><PRE><SPAN class=070215912-17072006>&lt;html&gt;<BR>&lt;head&gt;&lt;title&gt;Narrative Report&lt;/title&gt;&lt;/head&gt;<BR>&lt;body&gt;<BR></SPAN><SPAN class=070215912-17072006></SPAN></PRE><PRE><SPAN class=070215912-17072006>&lt;h1&gt;PNG&lt;/h1&gt;<BR>&lt;!-- PAGE BREAK --&gt;<BR></SPAN></PRE><PRE><SPAN class=070215912-17072006>&lt;/body&gt;<BR>&lt;/html&gt;<BR></SPAN></PRE><PRE><SPAN class=070215912-17072006>I'm at a loss to explain the truncation.  Can anyone offer some suggestions?</PRE></SPAN></SPAN></DIV>
    <P>
    <HR>

    <P></P>_______________________________________________<BR>Zope 
    maillist&nbsp; -&nbsp; 
    Zope@zope.org<BR>http://mail.zope.org/mailman/listinfo/zope<BR>**&nbsp;&nbsp; 
    No cross posts or HTML encoding!&nbsp; **<BR>(Related lists - 
    <BR>&nbsp;http://mail.zope.org/mailman/listinfo/zope-announce<BR>&nbsp;http://mail.zope.org/mailman/listinfo/zope-dev 
    )<BR></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>