Re: Creating PDF of BOM

Posted by Midhat on
URL: http://ofbiz.116.s1.nabble.com/Creating-PDF-of-BOM-tp140896p140898.html

I can handle a li'l bit XSLFO but how do i get the tree used in
BomSimulation.ftl into my fo.ftl file. i tried pasting the original code
into a fo.ftl file and adding necessary tags for a XSLFO document. but it
generates a blank pdf. my BomSimulation.ftl links to a request uri
containing a screen containing  BomSimulation.fo.ftl. my
bomsimulation.fo.ftl file is as follows:

<?xml version="1.0" encoding="UTF-8"?>
  <root xmlns="http://www.w3.org/1999/XSL/Format"
   font-size="16pt">
   <layout-master-set>

   <simple-page-master
   margin-right="15mm" margin-left="15mm"
   margin-bottom="15mm" margin-top="15mm"
   page-width="210mm" page-height="297mm"
   master-name="bookpage">
   <region-body region-name="bookpage-body"

   margin-bottom="5mm" margin-top="5mm" />
   </simple-page-master>
   </layout-master-set>
   <page-sequence master-reference="bookpage">
   <title>Hello world example</title>

   <flow flow-name="bookpage-body">
   <block>
test data
<#if requestParameters.lookupFlag?default("N") == "Y">

<#if selectedFeatures?has_content>

<div class="tableheadtext">${uiLabelMap.ManufacturingSelectedFeatures}</div>
<#list selectedFeatures as selectedFeature>
    <div class="tabletext">${selectedFeature.productFeatureTypeId} = ${
selectedFeature.description?if_exists} [${selectedFeature.productFeatureId
}]</div>
</#list>
</#if>


      <table border='0' cellspacing='0' cellpadding='2' class='boxbottom'>
        <tr>
          <td width="10%" align="left"><div class="tableheadtext">${
uiLabelMap.ManufacturingProductLevel}</div></td>
          <td width="20%" align="left"><div class="tableheadtext">${
uiLabelMap.ProductProductId}</div></td>
          <td width="10%" align="left"><div
class="tableheadtext">---</div></td>
          <td width="30%" align="left"><div class="tableheadtext">${
uiLabelMap.ProductProductName}</div></td>
          <td width="10%" align="right"><div class="tableheadtext">${
uiLabelMap.CommonQuantity}</div></td>
          <td width="10%" align="right"><div class="tableheadtext">${
uiLabelMap.ManufacturingComponentCost}</div></td>
          <td width="10%" align="right"><div class="tableheadtext">${
uiLabelMap.ManufacturingComponentValue}</div></td>
        </tr>
        <tr>
          <td colspan='5'></td>
        </tr>
        <#if tree?has_content>
          <#assign rowClass = "viewManyTR2">
          <#list tree as node>
            <#-- toggle the row color -->
            <#if rowClass == "viewManyTR2">
              <#assign rowClass = "viewManyTR1">
            <#else>
              <#assign rowClass = "viewManyTR2">
            </#if>
          </#list>
        <#else>
          <tr>
            <td colspan='4'><div class='head3'>${
uiLabelMap.CommonNoElementFound}.</div></td>
          </tr>
        </#if>
      </table>
      <table border='0' cellspacing='0' cellpadding='2' class='boxbottom'>
        <tr>
          <td width="20%" align="left"><div class="tableheadtext">${
uiLabelMap.ProductProductId}</div></td>
          <td width="40%" align="left"><div class="tableheadtext">${
uiLabelMap.ProductProductName}</div></td>
          <td width="40%" align="right"><div class="tableheadtext">${
uiLabelMap.CommonQuantity}</div></td>
        </tr>
        <tr>
          <td colspan='3'></td>
        </tr>
        <#if treeQty?has_content>
          <#assign rowClass = "viewManyTR2">
          <#list treeQty as nodeQty>
            <tr class='${rowClass}'>
              <td>${nodeQty.product.productId}</td>
              <td>${nodeQty.product.internalName?default("&nbsp;")}</td>
              <td align="right">${nodeQty.quantity}</td>
            </tr>
            <#-- toggle the row color -->
            <#if rowClass == "viewManyTR2">
              <#assign rowClass = "viewManyTR1">
            <#else>
              <#assign rowClass = "viewManyTR2">
            </#if>
          </#list>
        <#else>
          <tr>
            <td colspan='4'><div class='head3'>${
uiLabelMap.CommonNoElementFound}.</div></td>
          </tr>
        </#if>
      </table>
</#if>

</block>
   </flow>
   </page-sequence>

  </root>