6 Replies Latest reply on Jul 29, 2009 6:47 PM by mdesignz

    p:html ignores size in p:font

    mdesignz

      Not sure if this is a bug or unimplemented feature.  I have a situation where a user may enter text which becomes rendered in a PDF.  To allow some formatting, I'm using something like this (attributes omitted for readability)




      <p:paragraph>
         <p:font>
            <p:html/>
         </p:font>
      </p:paragraph>











      The text in the p:html obeys the font name (e.g., helvetica, times roman, etc.) specified in the p:font tag, but ignores the font size.  I can control the font size by embedding html tags like <h4> and <h5> within the text, but this is a tacky solution.


      Also, is there a way to implement a CSS within a Seam PDF file.  I believe the Excel rendering has such a feature, but not for PDF.


        • 1. Re: p:html ignores size in p:font
          mdesignz

          A solution for this is to use the RichFaces rich:editor for input, and then p:html and s:formattedText to render it within the PDF.  To embed EL expressions, I had to strip the leading slash that TinyMCE uses to escape the # prior to doing an EL evaluation, but it seems to be working well.

          • 2. Re: p:html ignores size in p:font
            norman

            p:html is really limited.  If anyone has ideas on how to make it work better or want to contribute some code to make it a bit more useful, I'm quite open. 

            • 3. Re: p:html ignores size in p:font
              nickarls

              We could check if the Excel CSS could be used in PDF generation since it shares a lot of similarities regarding architechture and delivery mechanism...

              • 4. Re: p:html ignores size in p:font
                mdesignz

                Having the CSS available to the PDF would be very helpful.

                • 5. Re: p:html ignores size in p:font
                  I've found a workaround for this restriction, you shouldn't use the <p:font> implementation outside an <p:html> tag from seam in this case, but you should use a html 'font' tag inside the <p:html> as follows :

                  <p:paragraph alignment="right">
                    <p:html>
                      <font size="10px" face="Arial" style="font-weight:bold;">
                        <h:outputText value="#{myBean.dateExport}">
                          <s:convertDateTime type="date" dateStyle="short" pattern="#{messages['pdf.document.date.pattern']}"/>
                        </h:outputText>
                    </font>
                    </p:html>
                  </p:paragraph>

                  • 6. Re: p:html ignores size in p:font
                    mdesignz

                    The problem with this is the TinyMCE component used in Richfaces doesn't generate html text like you have shown above.  It uses relative font sizing like:  font: small, which is why it would be great to have some way to reference a CSS much like the Excel tags allow.