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 Rabih Yassine <Ra...@linkvest.com> on 2003/02/20 07:33:58 UTC

empty pdf file


Hello,

 I generated the FO file in order to generate a pdf file. But when i open
the file i get nothing in it.
 Also, I need to know how can i seperate pages?

Thanks




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: empty pdf file

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Rabih Yassine wrote:


> For each bundle i want to write the Bundle Number and no of subscribers on a
> new page.
> But when i use <fo:block break-before="page"> i will have only one bundle on
> a new page although in my xml file i have 3 bundle lists.
You should have each bundle starting new page. Sorry, isn't it what are you 
asking for?

-- 
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: empty pdf file

Posted by Rabih Yassine <Ra...@linkvest.com>.

ok.

 Suppose i have a list in an xml file say bundles.
 Every list has some data in it.
 For example i have this:

		<xsl:for-each select="./OFFER_BUNDLES">
		  <fo:block break-before="page">
		     <fo:table>
				<fo:table-column/>
				<fo:table-column/>
					<fo:table-body>
						<fo:table-row>
							<fo:table-cell><fo:block font-size="12pt"><xsl:text>Bundle
Number</xsl:text></fo:block></fo:table-cell>
							<fo:table-cell><fo:block font-size="10pt"><xsl:value-of
select="./BUNDLE/BUNDLE_SEQ"/></fo:block></fo:table-cell>
						</fo:table-row>
						<fo:table-row>
							<fo:table-cell><fo:block font-size="12pt"><xsl:text>Number of
Subscribers in Bundle</xsl:text></fo:block></fo:table-cell>
							<fo:table-cell><fo:block font-size="10pt"><xsl:value-of
select="./BUNDLE/NO_OF_SUBSCRIBERS"/></fo:block></fo:table-cell>
						</fo:table-row>
					</fo:table-body>
			</fo:table>

For each bundle i want to write the Bundle Number and no of subscribers on a
new page.
But when i use <fo:block break-before="page"> i will have only one bundle on
a new page although in my xml file i have 3 bundle lists.

-----Original Message-----
From: Oleg Tkachenko [mailto:olegt@multiconn.com]
Sent: Thursday, February 20, 2003 12:54 PM
To: fop-user@xml.apache.org
Subject: Re: empty pdf file


Rabih Yassine wrote:

>  I have this in my xsl file:
>
> 	<xsl:for-each select="./OFFER_BUNDLES">
> 		  <fo:block break-before="page">
>       .....
>
>  I guess this is breaking the loop.
What do you mean?


>  Also, How can i name column names in a table?
Why?

--
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: empty pdf file

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Rabih Yassine wrote:

>  I have this in my xsl file:
> 
> 	<xsl:for-each select="./OFFER_BUNDLES">
> 		  <fo:block break-before="page">
>       .....
> 
>  I guess this is breaking the loop.
What do you mean?


>  Also, How can i name column names in a table?
Why?

-- 
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: empty pdf file

Posted by Rabih Yassine <Ra...@linkvest.com>.

 I have this in my xsl file:

	<xsl:for-each select="./OFFER_BUNDLES">
		  <fo:block break-before="page">
      .....

 I guess this is breaking the loop.

 Also, How can i name column names in a table?


-----Original Message-----
From: Oleg Tkachenko [mailto:olegt@multiconn.com]
Sent: Thursday, February 20, 2003 11:39 AM
To: fop-user@xml.apache.org
Subject: Re: empty pdf file


Rabih Yassine wrote:
> Ok. Thanks it works now.
> I have another question now.
> If i have a list in the xml file. For example a list of bundles. And every
> bundle should be in a new page.
> How can i do that? They should be created dynamically.

<xsl:template match="bundle">
	<fo:block break-before="page">
		...
	</fo:block>
</xsl:template>
This will force page break before each of these fo:block objects.
Alternatively use break-after="page".
--
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: empty pdf file

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Rabih Yassine wrote:
> Ok. Thanks it works now.
> I have another question now.
> If i have a list in the xml file. For example a list of bundles. And every
> bundle should be in a new page.
> How can i do that? They should be created dynamically.

<xsl:template match="bundle">
	<fo:block break-before="page">
		...
	</fo:block>
</xsl:template>
This will force page break before each of these fo:block objects.
Alternatively use break-after="page".
-- 
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: empty pdf file

Posted by Rabih Yassine <Ra...@linkvest.com>.
Ok. Thanks it works now.
I have another question now.
If i have a list in the xml file. For example a list of bundles. And every
bundle should be in a new page.
How can i do that? They should be created dynamically.


-----Original Message-----
From: Oleg Tkachenko [mailto:olegt@multiconn.com]
Sent: Thursday, February 20, 2003 11:07 AM
To: fop-user@xml.apache.org
Subject: Re: empty pdf file


Rabih Yassine wrote:

>             InputSource in = new InputSource(file);
>             ByteArrayOutputStream out = new ByteArrayOutputStream();
>             Driver driver = new Driver(in, out);
>             driver.setLogger(log);
>             driver.setRenderer(Driver.RENDER_PDF);
>             driver.run();
>             byte[] content = out.toByteArray();
>
>             FileWriter f = new FileWriter("D:/kokeet4.pdf");
>             f.write(new String(content));
>             f.flush();

Probably FileWriter spoils binary pdf content, use OutputStream instead, see
FopServlet example in contrib/servlet/src directory.

--
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: empty pdf file

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Rabih Yassine wrote:

>             InputSource in = new InputSource(file);
>             ByteArrayOutputStream out = new ByteArrayOutputStream();
>             Driver driver = new Driver(in, out);
>             driver.setLogger(log);
>             driver.setRenderer(Driver.RENDER_PDF);
>             driver.run();
>             byte[] content = out.toByteArray();
> 
>             FileWriter f = new FileWriter("D:/kokeet4.pdf");
>             f.write(new String(content));
>             f.flush();

Probably FileWriter spoils binary pdf content, use OutputStream instead, see 
FopServlet example in contrib/servlet/src directory.

-- 
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: empty pdf file

Posted by Rabih Yassine <Ra...@linkvest.com>.

 Ok. Here is the java code that i am using. But i am not getting any error
messages!

            System.setProperty("org.xml.sax.driver",
"org.apache.xerces.parsers.SAXParser");
            TransformerFactory tfactory =  TransformerFactory.newInstance();
            File fff = new File("d:/kokeet4.xsl");
            Transformer transformer= tfactory.newTransformer(new
StreamSource(fff));
            File ff = new File("D:/kokeet4.xml");
            transformer.transform(new StreamSource(ff),new StreamResult(new
FileOutputStream("d:/kokeet4.fo" )));

            FileInputStream file = new FileInputStream("D:/kokeet4.fo");


            Logger log = new ConsoleLogger(ConsoleLogger.LEVEL_WARN);
            MessageHandler.setScreenLogger(log);

            InputSource in = new InputSource(file);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            Driver driver = new Driver(in, out);
            driver.setLogger(log);
            driver.setRenderer(Driver.RENDER_PDF);
            driver.run();
            byte[] content = out.toByteArray();

            FileWriter f = new FileWriter("D:/kokeet4.pdf");
            f.write(new String(content));
            f.flush();

-----Original Message-----
From: Oleg Tkachenko [mailto:olegt@multiconn.com]
Sent: Thursday, February 20, 2003 10:34 AM
To: fop-user@xml.apache.org
Subject: Re: empty pdf file


Rabih Yassine wrote:

> and here is the fo file (generated)
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root
>
xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simpl
> e-page-master margin-right="2.5cm" margin-left="2.5cm" margin-bottom="2cm"
> margin-top="1cm" page-width="21cm" page-height="29.7cm"
> master-name="first"><fo:region-body margin-top="3cm"/><fo:region-before
> extent="3cm"/><fo:region-after
>
extent="1.5cm"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequ
> ence master-reference="first"><fo:flow
>
flow-name="xsl-region-body"><fo:block>OfferNumber</fo:block></fo:flow></fo:p
> age-sequence></fo:root>

Works fine for me. Most likely you run FOP in a wrong way and ignore error
its
messages. Show us how do you run FOP and what is info messages.


PS. And please, turn off this annoying Return Request, you are posting to
mail
list and your posting is read by many people, do you really want to be
notified by all of them?
--
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: empty pdf file

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Rabih Yassine wrote:

> and here is the fo file (generated)
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root
> xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simpl
> e-page-master margin-right="2.5cm" margin-left="2.5cm" margin-bottom="2cm"
> margin-top="1cm" page-width="21cm" page-height="29.7cm"
> master-name="first"><fo:region-body margin-top="3cm"/><fo:region-before
> extent="3cm"/><fo:region-after
> extent="1.5cm"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequ
> ence master-reference="first"><fo:flow
> flow-name="xsl-region-body"><fo:block>OfferNumber</fo:block></fo:flow></fo:p
> age-sequence></fo:root>

Works fine for me. Most likely you run FOP in a wrong way and ignore error its 
messages. Show us how do you run FOP and what is info messages.


PS. And please, turn off this annoying Return Request, you are posting to mail 
list and your posting is read by many people, do you really want to be 
notified by all of them?
-- 
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


RE: empty pdf file

Posted by Rabih Yassine <Ra...@linkvest.com>.
Well,

 here is my xlst: It is a very simple one

<xsl:stylesheet version="1.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:fo="http://www.w3.org/1999/XSL/Format">
<xsl:template match="pdf_generator">
    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
      <fo:layout-master-set>
			<fo:simple-page-master master-name="first"
									page-height="29.7cm"
									page-width="21cm"
									margin-top="1cm"
									margin-bottom="2cm"
									margin-left="2.5cm"
									margin-right="2.5cm">
			<fo:region-body margin-top="3cm"/>
			<fo:region-before extent="3cm"/>
			<fo:region-after extent="1.5cm"/>
	   </fo:simple-page-master>
     </fo:layout-master-set>
     <fo:page-sequence master-reference="first">
       <fo:flow flow-name="xsl-region-body">
          <xsl:apply-templates/>
        </fo:flow>
     </fo:page-sequence>
    </fo:root>
</xsl:template>

  <xsl:template match="pdf_generator/OFFER">
       <fo:block>OfferNumber</fo:block>
  </xsl:template>
</xsl:stylesheet>


and here is the fo file (generated)
<?xml version="1.0" encoding="UTF-8"?>
<fo:root
xmlns:fo="http://www.w3.org/1999/XSL/Format"><fo:layout-master-set><fo:simpl
e-page-master margin-right="2.5cm" margin-left="2.5cm" margin-bottom="2cm"
margin-top="1cm" page-width="21cm" page-height="29.7cm"
master-name="first"><fo:region-body margin-top="3cm"/><fo:region-before
extent="3cm"/><fo:region-after
extent="1.5cm"/></fo:simple-page-master></fo:layout-master-set><fo:page-sequ
ence master-reference="first"><fo:flow
flow-name="xsl-region-body"><fo:block>OfferNumber</fo:block></fo:flow></fo:p
age-sequence></fo:root>


But when i open the pdf file i get this error message now:
There was an error processing the page. Too few operands.
Unrecognized token was found.
Illegal operation inside a text object.



-----Original Message-----
From: Oleg Tkachenko [mailto:olegt@multiconn.com]
Sent: Thursday, February 20, 2003 10:09 AM
To: fop-user@xml.apache.org
Subject: Re: empty pdf file


Rabih Yassine wrote:

>  I generated the FO file in order to generate a pdf file. But when i open
> the file i get nothing in it.
May be due to zillion reasons. Elaborate please, what are you running, how
and
what are log messages.

>  Also, I need to know how can i seperate pages?
Use break-after="page" property.

--
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org


Re: empty pdf file

Posted by Oleg Tkachenko <ol...@multiconn.com>.
Rabih Yassine wrote:

>  I generated the FO file in order to generate a pdf file. But when i open
> the file i get nothing in it.
May be due to zillion reasons. Elaborate please, what are you running, how and 
what are log messages.

>  Also, I need to know how can i seperate pages?
Use break-after="page" property.

-- 
Oleg Tkachenko
Multiconn Technologies, Israel


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-user-unsubscribe@xml.apache.org
For additional commands, e-mail: fop-user-help@xml.apache.org