FOP Newbie

2008-08-08 Thread moorzee

Hi

I have a requirement to output, what I hope, is going to be a very simple
PDF document. I'll be building up an xml domdocument in VB. My question is
can I output my PDF without the need to save the xml as a file, i.e pass the
xml directly into fop with my style sheet and output my PFD?

Any help appreciated.

Cheers.
-- 
View this message in context: 
http://www.nabble.com/FOP-Newbie-tp18890672p18890672.html
Sent from the FOP - Users mailing list archive at Nabble.com.


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FOP Newbie

2008-08-08 Thread paul womack

moorzee wrote:

Hi

I have a requirement to output, what I hope, is going to be a very simple
PDF document. I'll be building up an xml domdocument in VB. My question is
can I output my PDF without the need to save the xml as a file, i.e pass the
xml directly into fop with my style sheet and output my PFD?


At the risk of reverse engineering instead of reading documents,
I just grepped the source tree, and System.in
(Java's version of STDIN)
does not appear very often - so I suspect fop cannot
be piped to (on the command line) which is what you appear
to require.

  BugBear

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: FOP Newbie

2008-08-08 Thread Jeremias Maerki
FOP Trunk can: http://markmail.org/message/alyr3kbx5kp4z77i

On 08.08.2008 15:30:15 paul womack wrote:
 moorzee wrote:
  Hi
  
  I have a requirement to output, what I hope, is going to be a very simple
  PDF document. I'll be building up an xml domdocument in VB. My question is
  can I output my PDF without the need to save the xml as a file, i.e pass the
  xml directly into fop with my style sheet and output my PFD?
 
 At the risk of reverse engineering instead of reading documents,
 I just grepped the source tree, and System.in
 (Java's version of STDIN)
 does not appear very often - so I suspect fop cannot
 be piped to (on the command line) which is what you appear
 to require.
 
BugBear



Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Upgrade to v 0.95 from 0.20.5 with custom modifications

2008-08-08 Thread Brian Trezise
So I just upgraded us from Fop v. 0.20.5 to v 0.95 because our old version
of the software was not properly handling newer svg image specifications.
In the previous version we had to overload the PDFTranscoder class in order
to allow us to custom specify the x,y position of an SVG image on the pdf
page. 

 

So I guess the first question would be, is it now possible to set the x,y
position of a svg image within a document with v 0.95?  I haven't seen
anything in the documentation anywhere to indicate that it is, but it would
make life much nicer if so.

 

Next question, assuming the answer to the first question is no:  Our old
overload of the PDFTranscoder class used a PDFGraphics2D object,
instantiated with the now-protected PDFGraphics2D(Boolean textAsShapes)
constructor.  I have tried to change over to the new many-argument
constructor however in creating a new document to send through I end up
getting a blank page back.  Is there a way to access the protected
constructor (or equivalent functionality) somehow?

 

Lastly, we have a PDFObject class that makes use of several different
filters.  Since all the code was the same for each filter, I'll just show
one example from the switch statement:



The old code looked like this:

  case FILTER_FLATE:

 FlateFilter ff = new FlateFilter();

 this.streamContent = ff.encode(this.streamContent);

 PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);

 dictionary.add(flate);

 break;

 

The old encode() method took a byte array and returned a byte array; however
that method no longer exists.  It appears that the replacement functionality
is applyFilter which takes an OutputStream and returns an OutputStream.  I
replaced the above code with the following, but am unsure if this is the
correct way to handle the situation.  The goal here is to avoid breaking any
more code than strictly necessary to perform this upgrade


  case FILTER_FLATE:

 FlateFilter ff = new FlateFilter();

 this.streamContent = ((FlateEncodeOutputStream)
ff.applyFilter(out)).toString().getBytes();

 PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);

 dictionary.add(flate);

 break;

 

I sincerely appreciate any assistance you can offer,

___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]

 



Re: FOP Newbie

2008-08-08 Thread Andreas Delmelle

On Aug 8, 2008, at 14:04, moorzee wrote:

I have a requirement to output, what I hope, is going to be a very  
simple
PDF document. I'll be building up an xml domdocument in VB. My  
question is
can I output my PDF without the need to save the xml as a file, i.e  
pass the

xml directly into fop with my style sheet and output my PFD?


From VB? I don't think so (unless there exists a VB-to-Java  
interface). Definitely not with 0.95 (or earlier). In FOP Trunk, the  
option has been added to take input from stdin or send the output to  
stdout, which IIC should enable one to avoid writing a temporary file.



Cheers

Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Upgrade to v 0.95 from 0.20.5 with custom modifications

2008-08-08 Thread Jeremias Maerki
On 08.08.2008 17:30:22 Brian Trezise wrote:
 So I just upgraded us from Fop v. 0.20.5 to v 0.95 because our old version
 of the software was not properly handling newer svg image specifications.
 In the previous version we had to overload the PDFTranscoder class in order
 to allow us to custom specify the x,y position of an SVG image on the pdf
 page. 
 
  
 
 So I guess the first question would be, is it now possible to set the x,y
 position of a svg image within a document with v 0.95?  I haven't seen
 anything in the documentation anywhere to indicate that it is, but it would
 make life much nicer if so.

If Batik can't, then the PDFTranscoder can't either. The Transcoder API
is something defined by Batik. Can you please explain to me what exactly
you're trying to do? I get the impression that you want to convert an
SVG to PDF, but the PDF page shall be larger than the SVG itself and
that's why you have to position it within the page. Is that correct?

I've seen in Batik that the ToSVGAbstractTranscoder contains
TranscodingHints.Keys for X/Y-Offset. It might be an idea to add support
for those in the PDFTranscoder if you want a clean solution rather than
force/hack the code into submission from the outside.

 Next question, assuming the answer to the first question is no:  Our old
 overload of the PDFTranscoder class used a PDFGraphics2D object,
 instantiated with the now-protected PDFGraphics2D(Boolean textAsShapes)
 constructor.  I have tried to change over to the new many-argument
 constructor however in creating a new document to send through I end up
 getting a blank page back.  Is there a way to access the protected
 constructor (or equivalent functionality) somehow?

Why do you want to interface with PDFGraphics2D? In PDFTranscoder, a
PDFDocumentGraphics2D is used because you also need to create the PDF
container around the SVG content.

Anyway, I think it would be a lot simpler for you if you just used
XSL-FO to position your SVG on a page. That is easily done through an
XSLT stylesheet that wraps your SVG in an XSL-FO document (using
fo:instream-foreign-object). Using a block-container with
absolute-position=fixed it's easy to position the SVG in any size
anywhere on the page.

 Lastly, we have a PDFObject class that makes use of several different
 filters.  Since all the code was the same for each filter, I'll just show
 one example from the switch statement:
 
 
 
 The old code looked like this:
 
   case FILTER_FLATE:
 
  FlateFilter ff = new FlateFilter();
 
  this.streamContent = ff.encode(this.streamContent);
 
  PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);
 
  dictionary.add(flate);
 
  break;
 
  
 
 The old encode() method took a byte array and returned a byte array; however
 that method no longer exists.  It appears that the replacement functionality
 is applyFilter which takes an OutputStream and returns an OutputStream. 

Yes, that was optimization work to avoid buffering whole streams in
memory. It's now faster und uses less memory.

  I
 replaced the above code with the following, but am unsure if this is the
 correct way to handle the situation.  The goal here is to avoid breaking any
 more code than strictly necessary to perform this upgrade
 
 
   case FILTER_FLATE:
 
  FlateFilter ff = new FlateFilter();
 
  this.streamContent = ((FlateEncodeOutputStream)
 ff.applyFilter(out)).toString().getBytes();
 
  PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);
 
  dictionary.add(flate);
 
  break;

And what exactly are you trying to do here? I don't get it.

  
 
 I sincerely appreciate any assistance you can offer,
 
 ___
 Brian Trezise
 Staff Software Engineer
 IntelliData, Inc
 3173 s. uravan way
 aurora, colorado 80013
 T: 720.524.4864
 [EMAIL PROTECTED]
 
  
 




Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Fop-0.95 - Table questions

2008-08-08 Thread Steffanina, Jeff

I have a table that is 8 cols by many rows.

TABLE ISSUE  I
The column ItemDesc is left aligned.  BUT on occasion, the ItemDesc
begins with 4 leading spaces.  In my output .PDF, the leading spaces are
always removed.

How can I force the leading spaces in the ItemDesc to be included in the
output?  Here is what I currently have for the field:
fo:table-cell
  fo:block
xsl:attribute name=white-space-collapsefalse/xsl:attribute
xsl:value-of select=itemdesc/
  /fo:block
/fo:table-cell

TABLE ISSUE II
Of the 8 columns in my table, I only need to print 5 of them.  The other
3 cols are used to evaluate the record and evaluate data using test.
My problem is that It seems that once the table is defined and values
selected, you have no choice but to print the value.

How can I keep populated objects in a table from printing?

Thanks for your assistance.

Jeff 


RE: Fop-0.95 - Table questions

2008-08-08 Thread Steffanina, Jeff

   
WHEN I CHANGED IT TO PRESERVE AS BELOW:
fo:table-cell
  fo:block
xsl:attribute
name=white-space-collapsepreserve/xsl:attribute
xsl:value-of select=item/
  /fo:block
/fo:table-cell


I GOT THE FOLLOWING ERROR:
SEVERE: Ignoring property: white-space-collapse=preserve (No
conversion defined preserve; property:'white-space-collapse')
Aug 8, 2008 4:45:39 PM org.apache.fop.fo.PropertyList
convertAttributeToProperty 


Jeff Steffanina
FOSSE Development,  Bethesda, MD
(301)380-2047
[EMAIL PROTECTED]

This communication contains information from Marriott International,
Inc. that may be confidential. Except for personal use by the intended
recipient, or as expressly authorized by the sender, any person who
receives this information is prohibited from disclosing, copying,
distributing, and/or using it. If you have received this communication
in error, please immediately delete it and all copies, and promptly
notify the sender. Nothing in this communication is intended as an
electronic signature under applicable law.


-Original Message-
From: Andreas Delmelle [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2008 4:39 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Fop-0.95 - Table questions

On Aug 8, 2008, at 21:57, Steffanina, Jeff wrote:

Hi
 TABLE ISSUE  I
 The column ItemDesc is left aligned.  BUT on occasion, the  
 ItemDesc begins with 4 leading spaces.  In my output .PDF, the  
 leading spaces are always removed.

 How can I force the leading spaces in the ItemDesc to be included  
 in the output?  Here is what I currently have for the field:

 fo:table-cell
   fo:block
 xsl:attribute name=white-space-collapsefalse/ 
 xsl:attribute


Try adding:
   xsl:attribute name=white-space-treatmentpreserve/xsl:attribute

This will effectively preserve any white-space, including spaces  
surrounding line-breaks.


HTH!

Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Fop-0.95 - Table questions

2008-08-08 Thread Steffanina, Jeff


I resolved it... You have to use:

name=white-space-treatmentpreserve 


Jeff Steffanina
FOSSE Development,  Bethesda, MD
(301)380-2047
[EMAIL PROTECTED]

This communication contains information from Marriott International,
Inc. that may be confidential. Except for personal use by the intended
recipient, or as expressly authorized by the sender, any person who
receives this information is prohibited from disclosing, copying,
distributing, and/or using it. If you have received this communication
in error, please immediately delete it and all copies, and promptly
notify the sender. Nothing in this communication is intended as an
electronic signature under applicable law.


-Original Message-
From: Steffanina, Jeff [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2008 4:49 PM
To: fop-users@xmlgraphics.apache.org
Subject: RE: Fop-0.95 - Table questions


   
WHEN I CHANGED IT TO PRESERVE AS BELOW:
fo:table-cell
  fo:block
xsl:attribute
name=white-space-collapsepreserve/xsl:attribute
xsl:value-of select=item/
  /fo:block
/fo:table-cell


I GOT THE FOLLOWING ERROR:
SEVERE: Ignoring property: white-space-collapse=preserve (No
conversion defined preserve; property:'white-space-collapse')
Aug 8, 2008 4:45:39 PM org.apache.fop.fo.PropertyList
convertAttributeToProperty 


Jeff Steffanina
FOSSE Development,  Bethesda, MD
(301)380-2047
[EMAIL PROTECTED]

This communication contains information from Marriott International,
Inc. that may be confidential. Except for personal use by the intended
recipient, or as expressly authorized by the sender, any person who
receives this information is prohibited from disclosing, copying,
distributing, and/or using it. If you have received this communication
in error, please immediately delete it and all copies, and promptly
notify the sender. Nothing in this communication is intended as an
electronic signature under applicable law.


-Original Message-
From: Andreas Delmelle [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2008 4:39 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Fop-0.95 - Table questions

On Aug 8, 2008, at 21:57, Steffanina, Jeff wrote:

Hi
 TABLE ISSUE  I
 The column ItemDesc is left aligned.  BUT on occasion, the  
 ItemDesc begins with 4 leading spaces.  In my output .PDF, the  
 leading spaces are always removed.

 How can I force the leading spaces in the ItemDesc to be included  
 in the output?  Here is what I currently have for the field:

 fo:table-cell
   fo:block
 xsl:attribute name=white-space-collapsefalse/ 
 xsl:attribute


Try adding:
   xsl:attribute name=white-space-treatmentpreserve/xsl:attribute

This will effectively preserve any white-space, including spaces  
surrounding line-breaks.


HTH!

Andreas

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Upgrade to v 0.95 from 0.20.5 with custom modifications

2008-08-08 Thread Brian Trezise
Yes, essentially we are inserting an SVG image of a part schematic (eg a
capacitor), and then using dynamically generated data from a database to
describe that part.


  I
 replaced the above code with the following, but am unsure if this is the
 correct way to handle the situation.  The goal here is to avoid breaking
any
 more code than strictly necessary to perform this upgrade
 
 
   case FILTER_FLATE:
 
  FlateFilter ff = new FlateFilter();
 
  this.streamContent = ((FlateEncodeOutputStream)
 ff.applyFilter(out)).toString().getBytes();
 
  PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);
 
  dictionary.add(flate);
 
  break;

And what exactly are you trying to do here? I don't get it.

I'm trying to convert the OutputStream back to a byte array for backward
compatibility with the rest of our software; hoping not to have to rewrite
the entire svg handler :)
___
Brian Trezise
Staff Software Engineer
IntelliData, Inc
3173 s. uravan way
aurora, colorado 80013
T: 720.524.4864
[EMAIL PROTECTED]


-Original Message-
From: Jeremias Maerki [mailto:[EMAIL PROTECTED] 
Sent: Friday, August 08, 2008 12:21 PM
To: fop-users@xmlgraphics.apache.org
Subject: Re: Upgrade to v 0.95 from 0.20.5 with custom modifications

On 08.08.2008 17:30:22 Brian Trezise wrote:
 So I just upgraded us from Fop v. 0.20.5 to v 0.95 because our old version
 of the software was not properly handling newer svg image specifications.
 In the previous version we had to overload the PDFTranscoder class in
order
 to allow us to custom specify the x,y position of an SVG image on the pdf
 page. 
 
  
 
 So I guess the first question would be, is it now possible to set the x,y
 position of a svg image within a document with v 0.95?  I haven't seen
 anything in the documentation anywhere to indicate that it is, but it
would
 make life much nicer if so.

If Batik can't, then the PDFTranscoder can't either. The Transcoder API
is something defined by Batik. Can you please explain to me what exactly
you're trying to do? I get the impression that you want to convert an
SVG to PDF, but the PDF page shall be larger than the SVG itself and
that's why you have to position it within the page. Is that correct?

I've seen in Batik that the ToSVGAbstractTranscoder contains
TranscodingHints.Keys for X/Y-Offset. It might be an idea to add support
for those in the PDFTranscoder if you want a clean solution rather than
force/hack the code into submission from the outside.

 Next question, assuming the answer to the first question is no:  Our old
 overload of the PDFTranscoder class used a PDFGraphics2D object,
 instantiated with the now-protected PDFGraphics2D(Boolean textAsShapes)
 constructor.  I have tried to change over to the new many-argument
 constructor however in creating a new document to send through I end up
 getting a blank page back.  Is there a way to access the protected
 constructor (or equivalent functionality) somehow?

Why do you want to interface with PDFGraphics2D? In PDFTranscoder, a
PDFDocumentGraphics2D is used because you also need to create the PDF
container around the SVG content.

Anyway, I think it would be a lot simpler for you if you just used
XSL-FO to position your SVG on a page. That is easily done through an
XSLT stylesheet that wraps your SVG in an XSL-FO document (using
fo:instream-foreign-object). Using a block-container with
absolute-position=fixed it's easy to position the SVG in any size
anywhere on the page.

 Lastly, we have a PDFObject class that makes use of several different
 filters.  Since all the code was the same for each filter, I'll just show
 one example from the switch statement:
 
 
 
 The old code looked like this:
 
   case FILTER_FLATE:
 
  FlateFilter ff = new FlateFilter();
 
  this.streamContent = ff.encode(this.streamContent);
 
  PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);
 
  dictionary.add(flate);
 
  break;
 
  
 
 The old encode() method took a byte array and returned a byte array;
however
 that method no longer exists.  It appears that the replacement
functionality
 is applyFilter which takes an OutputStream and returns an OutputStream. 

Yes, that was optimization work to avoid buffering whole streams in
memory. It's now faster und uses less memory.

  I
 replaced the above code with the following, but am unsure if this is the
 correct way to handle the situation.  The goal here is to avoid breaking
any
 more code than strictly necessary to perform this upgrade
 
 
   case FILTER_FLATE:
 
  FlateFilter ff = new FlateFilter();
 
  this.streamContent = ((FlateEncodeOutputStream)
 ff.applyFilter(out)).toString().getBytes();
 
  PDFEntry flate = new PDFEntry(/Filter,/FlateDecode);
 
  dictionary.add(flate);
 
  break;

And what exactly are you trying to do here? I don't get it.

  
 
 I sincerely