You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by Balaji Loganathan <ba...@yahoo.com> on 2002/08/08 12:27:28 UTC

saving to a file.

Hi,
  The FOPServlet.java display the rendered pdf
document on the browser..
 Is it possible write that PDF into a file "foo.pdf"
instead of rendering it into browser. ?

Regards
Balaji

http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!

RE: sub, superscript

Posted by Richard Bondi <rb...@ergito.com>.
Excellent idea!
Thanks,
::r::b

At 01:55 PM 8/8/2002 -0400, you wrote:
>You could change the source code and recompile FOP so that it doesn't
>descend so low.  That was my solution.
>matthew l. avizinis


RE: sub, superscript

Posted by "Matthew L. Avizinis" <ml...@gleim.com>.
You could change the source code and recompile FOP so that it doesn't
descend so low.  That was my solution.
matthew l. avizinis

> -----Original Message-----
> From: sascha [mailto:sascha@assbach.de]
> Sent: Thursday, August 08, 2002 12:09 PM
> To: fop-user@xml.apache.org
> Subject: Re: sub, superscript
>
>
> yes, you're right i believe. didn't notice that yet-
> do you have a workaround then? something that does not descend
> into the next
> line?
>
>
> ----- Original Message -----
> From: "Richard Bondi" <rb...@ergito.com>
> To: <fo...@xml.apache.org>
> Sent: Thursday, August 08, 2002 5:48 PM
> Subject: Re: sub, superscript
>
>
> > Thanks, Sasha.
> >
> > Well, here's what I've discovered:
> >
> > 1) vertical-align isn't inherited, and
> > 2) the only vertical-align attributes fop 2.0.4 supports are 'sub' and
> > 'super', and
> > 3) that's a problem because 'sub' descends so far down, only a
> line-height
> > of about 160% prevents it from crashing into the next line.
> >
> > About the inheritance:
> >
> > This will not subscript:
> >
> >          <fo:inline vertical-align="sub">
> >                  <fo:inline font-family="Symbol">&#x03B1;</fo:inline>
> >          </fo:inline>
> >
> > This will:
> >
> >          <fo:inline vertical-align="sub"
> > font-family="Symbol">&#x03B1;</fo:inline>
> >
> > Thanks,
> > ::r::b
> >
>


Re: sub, superscript

Posted by Richard Bondi <rb...@ergito.com>.
I wish! I believe I am screwed, I'm making line-height="160%" everywhere. 
For example, decreasing the font size does NOT change the amount of the 
descent: it seems to be calculated from the surrounding baseline.

If there's a feature list for the next version, I would make adding the 
"length" or "percentage" attributes of vertical-align (7.29.22 of the 
recommendation) a very high priority.

::r::b

At 06:08 PM 8/8/2002 +0200, you wrote:
>yes, you're right i believe. didn't notice that yet-
>do you have a workaround then? something that does not descend into the next
>line?
>
>
>----- Original Message -----
>From: "Richard Bondi" <rb...@ergito.com>
>To: <fo...@xml.apache.org>
>Sent: Thursday, August 08, 2002 5:48 PM
>Subject: Re: sub, superscript
>
>
> > Thanks, Sasha.
> >
> > Well, here's what I've discovered:
> >
> > 1) vertical-align isn't inherited, and
> > 2) the only vertical-align attributes fop 2.0.4 supports are 'sub' and
> > 'super', and
> > 3) that's a problem because 'sub' descends so far down, only a line-height
> > of about 160% prevents it from crashing into the next line.
> >
> > About the inheritance:
> >
> > This will not subscript:
> >
> >          <fo:inline vertical-align="sub">
> >                  <fo:inline font-family="Symbol">&#x03B1;</fo:inline>
> >          </fo:inline>
> >
> > This will:
> >
> >          <fo:inline vertical-align="sub"
> > font-family="Symbol">&#x03B1;</fo:inline>
> >
> > Thanks,
> > ::r::b
> >


Re: sub, superscript

Posted by sascha <sa...@assbach.de>.
yes, you're right i believe. didn't notice that yet-
do you have a workaround then? something that does not descend into the next
line?


----- Original Message -----
From: "Richard Bondi" <rb...@ergito.com>
To: <fo...@xml.apache.org>
Sent: Thursday, August 08, 2002 5:48 PM
Subject: Re: sub, superscript


> Thanks, Sasha.
>
> Well, here's what I've discovered:
>
> 1) vertical-align isn't inherited, and
> 2) the only vertical-align attributes fop 2.0.4 supports are 'sub' and
> 'super', and
> 3) that's a problem because 'sub' descends so far down, only a line-height
> of about 160% prevents it from crashing into the next line.
>
> About the inheritance:
>
> This will not subscript:
>
>          <fo:inline vertical-align="sub">
>                  <fo:inline font-family="Symbol">&#x03B1;</fo:inline>
>          </fo:inline>
>
> This will:
>
>          <fo:inline vertical-align="sub"
> font-family="Symbol">&#x03B1;</fo:inline>
>
> Thanks,
> ::r::b
>


Re: sub, superscript

Posted by Richard Bondi <rb...@ergito.com>.
Thanks, Sasha.

Well, here's what I've discovered:

1) vertical-align isn't inherited, and
2) the only vertical-align attributes fop 2.0.4 supports are 'sub' and 
'super', and
3) that's a problem because 'sub' descends so far down, only a line-height 
of about 160% prevents it from crashing into the next line.

About the inheritance:

This will not subscript:

         <fo:inline vertical-align="sub">
                 <fo:inline font-family="Symbol">&#x03B1;</fo:inline>
         </fo:inline>

This will:

         <fo:inline vertical-align="sub" 
font-family="Symbol">&#x03B1;</fo:inline>

Thanks,
::r::b


Re: sub, superscript

Posted by sascha <sa...@assbach.de>.
excuse me Richard-
perhaps this only works with fo:inline not with block!?
example:
<fo:inline color="green" font-family="sans-serif" font-size="8pt"
vertical-align="super">superscript</fo:inline>



sascha



----- Original Message -----
From: "sascha" <sa...@assbach.de>
To: <fo...@xml.apache.org>
Sent: Thursday, August 08, 2002 3:27 PM
Subject: Re: sub, superscript


> Sure this is the fo code,
> i added an attribute "vertical-align" , see?
> so the result is
>
> <fo:block vertcal-align="sub">Text</fo:block>
> <fo:block vertcal-align="super">Text</fo:block>
>
> and if you want the text to be smaller- add a font-size attribute with an
> appropriate value!
>
> Greetings,
> Sascha
>
> ----- Original Message -----
> From: "Richard Bondi" <rb...@ergito.com>
> To: <fo...@xml.apache.org>; <sa...@assbach.de>
> Sent: Thursday, August 08, 2002 2:47 PM
> Subject: sub, superscript
>
>
> > Dear Sascha,
> >
> > You said in a recent post that vertical-align="sub", ="super" was
working
> > for you. It isn't working for me. You only posted the xsl without the
fo:
> > could you please post the fo code that worked for you?
> >
> > Thanks much,
> > Richard Bondi
> >
> >
> > You wrote:
> > ----------
> > From: sascha [mailto:sascha@assbach.de]
> > Sent: 05 August 2002 10:08
> > To: fop-user@xml.apache.org
> > Subject: Re: text-decoration
> >
> >
> > ok, i just tried out something:
> >
> > <xsl:if test='contains(dxl:font/@style,"subscript")'>
> >      <xsl:attribute name="vertical-align">sub</xsl:attribute>
> >      <xsl:attribute name="font-size"><xsl:value-of
> >
>
select="number(substring-before(dxl:font/@size,'pt'))-4"/>pt</xsl:attribute>
> >     </xsl:if>
> >
> >     <xsl:if test='contains(dxl:font/@style,"superscript")'>
> >      <xsl:attribute name="vertical-align">super</xsl:attribute>
> >      <xsl:attribute name="font-size"><xsl:value-of
> >
>
select="number(substring-before(dxl:font/@size,'pt'))-4"/>pt</xsl:attribute>
> >     </xsl:if>
> >
> >
> > and it seems to work.
> >
> > Sascha
> >
> >
>


Re: sub, superscript

Posted by sascha <sa...@assbach.de>.
Sure this is the fo code,
i added an attribute "vertical-align" , see?
so the result is

<fo:block vertcal-align="sub">Text</fo:block>
<fo:block vertcal-align="super">Text</fo:block>

and if you want the text to be smaller- add a font-size attribute with an
appropriate value!

Greetings,
Sascha

----- Original Message -----
From: "Richard Bondi" <rb...@ergito.com>
To: <fo...@xml.apache.org>; <sa...@assbach.de>
Sent: Thursday, August 08, 2002 2:47 PM
Subject: sub, superscript


> Dear Sascha,
>
> You said in a recent post that vertical-align="sub", ="super" was working
> for you. It isn't working for me. You only posted the xsl without the fo:
> could you please post the fo code that worked for you?
>
> Thanks much,
> Richard Bondi
>
>
> You wrote:
> ----------
> From: sascha [mailto:sascha@assbach.de]
> Sent: 05 August 2002 10:08
> To: fop-user@xml.apache.org
> Subject: Re: text-decoration
>
>
> ok, i just tried out something:
>
> <xsl:if test='contains(dxl:font/@style,"subscript")'>
>      <xsl:attribute name="vertical-align">sub</xsl:attribute>
>      <xsl:attribute name="font-size"><xsl:value-of
>
select="number(substring-before(dxl:font/@size,'pt'))-4"/>pt</xsl:attribute>
>     </xsl:if>
>
>     <xsl:if test='contains(dxl:font/@style,"superscript")'>
>      <xsl:attribute name="vertical-align">super</xsl:attribute>
>      <xsl:attribute name="font-size"><xsl:value-of
>
select="number(substring-before(dxl:font/@size,'pt'))-4"/>pt</xsl:attribute>
>     </xsl:if>
>
>
> and it seems to work.
>
> Sascha
>
>


sub, superscript

Posted by Richard Bondi <rb...@ergito.com>.
Dear Sascha,

You said in a recent post that vertical-align="sub", ="super" was working 
for you. It isn't working for me. You only posted the xsl without the fo: 
could you please post the fo code that worked for you?

Thanks much,
Richard Bondi


You wrote:
----------
From: sascha [mailto:sascha@assbach.de]
Sent: 05 August 2002 10:08
To: fop-user@xml.apache.org
Subject: Re: text-decoration


ok, i just tried out something:

<xsl:if test='contains(dxl:font/@style,"subscript")'>
     <xsl:attribute name="vertical-align">sub</xsl:attribute>
     <xsl:attribute name="font-size"><xsl:value-of
select="number(substring-before(dxl:font/@size,'pt'))-4"/>pt</xsl:attribute>
    </xsl:if>

    <xsl:if test='contains(dxl:font/@style,"superscript")'>
     <xsl:attribute name="vertical-align">super</xsl:attribute>
     <xsl:attribute name="font-size"><xsl:value-of
select="number(substring-before(dxl:font/@size,'pt'))-4"/>pt</xsl:attribute>
    </xsl:if>


and it seems to work.

Sascha


Re: saving to a file.

Posted by Balaji Loganathan <ba...@yahoo.com>.
Hi Oleg and Mike,
  Yeah ! Got a point from you now. Writing the byte[],
will try to code now.
 thanks for replying.
 Regards
Balaji


http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!

Re: saving to a file.

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Balaji Loganathan wrote:

>   The FOPServlet.java display the rendered pdf
> document on the browser..
>  Is it possible write that PDF into a file "foo.pdf"
> instead of rendering it into browser. ?

Get FOPServlet.java and change it how do you want, it's open source world.
You have byte[] after fop, just save it.

-- 
Oleg Tkachenko
Multiconn International, Israel


Re: saving to a file.

Posted by Balaji Loganathan <ba...@yahoo.com>.
Thanks everyone.
 I have made it with your helps.
Regards
Balaji

http://digital.yahoo.com.au - Yahoo! Digital How To
- Get the best out of your PC!

Re: saving to a file.

Posted by Biying Huang <bi...@synthematix.com>.
This works for me:

public static void createPdf( String xmlFile, String xslFile, String
pdfFile ){
  try{

      String[] params = new String[7];
      params[0] = "-xml";
      params[1] = xmlFile;
      params[2] = "-xsl";
      params[3] = xslFile;
      params[4] = "-pdf";
      params[5] = pdfFile;
      params[6] = "-d";

      CommandLineOptions options = null;

      options = new CommandLineOptions(params);
      Starter starter = options.getStarter();
      starter.run();
  } catch (Throwable e) {
          e.printStackTrace();

  }

}


Balaji Loganathan wrote:

> Hi,
>   The FOPServlet.java display the rendered pdf
> document on the browser..
>  Is it possible write that PDF into a file "foo.pdf"
> instead of rendering it into browser. ?
>
> Regards
> Balaji
>
> http://digital.yahoo.com.au - Yahoo! Digital How To
> - Get the best out of your PC!