Help! - Coverting From HTML to PDF using XSL FO - valign not working

Posted on 2004-11-23
Last Modified: 2013-11-18
Hi there,

I'm using the FOP from tool to convert from HTML
to PDF.

I'm reading the height and valign attributes of a column-cell (TD) in the XSL

 <xsl:attribute-set name="">
        <xsl:attribute name="border-style">solid</xsl:attribute>
     <xsl:attribute name="border-width">0pt</xsl:attribute>
     <xsl:attribute name="padding-start">0.3em</xsl:attribute>
     <xsl:attribute name="padding-end">0.2em</xsl:attribute>
     <xsl:attribute name="padding-before">2pt</xsl:attribute>
     <xsl:attribute name="padding-after">2pt</xsl:attribute>

<!-- HTML table tag <td> -->
<xsl:template match="td">
  <fo:table-cell xsl:use-attribute-sets="">
      <xsl:if test="@valign">
         <xsl:attribute name="display-align">
          <xsl:value-of select="@valign"/>
       <xsl:if test="@height">
         <xsl:attribute name="height">
         <xsl:value-of select="concat(@height,'px')"/>
       <xsl:if test="@class='smalltextwb'">
      <xsl:attribute name="font-family">Verdana, Arial, Helvetica, sans-serif</xsl:attribute>
         <xsl:attribute name="font-size">10px</xsl:attribute>
       <xsl:attribute name="font-weight">normal</xsl:attribute>
       <xsl:attribute name="color">#FFFFFF</xsl:attribute>
            <xsl:if test="@align">
               <xsl:attribute name="text-align">
                  <xsl:value-of select="@align"/>

When the pdf is generated, the valign doesnt work when the height is mentioned
on the HTML:

<td height="100" valign="center"> --> Doesnt work

<td valign="center"> --> works

Does anyone has any idea why the height property prevents the aligning
of the column cell on the PDF?

Tell me if you need more information

Any help will be great,
Question by:ronibr
    1 Comment
    LVL 2

    Accepted Solution

    i don;t think this wil support html to PDF conversion. it supports xml to PDF

    the following sourceforge might help you

    or else there is and odd way of doing it
    install PDF writer and make it as your default PDF writer
    open the html using Runtime API of java
    on load call print function.
    so the PDF file will be created same as HTML

    hope this help

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    Suggested Solutions

    Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
    Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
    The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
    HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now