Re: Problems with FOP and image

2011-06-10 Thread Rob Sargent
I suspect running from your jar does not have/use the same classpath 
that is in effect while you're in the debugger.

By what mechanism do you generate the jar?
Is it an executable jar or are you running java -classpath 
your-jar-here:other-jars Main?
Make your IDE (netbeans) display the classpath  it uses to run your app 
and compare that with the above.


On 06/09/2011 07:21 PM, Oscar.Flores wrote:

aaa ok well my problem is that when i do the pdf in netbean the pdf is fine
with images and evething but when i run the jar file in command it give me a
error

GRAVE: Error while processing image: I:\cfd\rfc.jpg (image/jpeg)
  org.apache.xmlgraphics.image.loader.ImageException: Cannot load
  image (no suitable loader/converter combination available) for
I:\cfd\rfc.jpg
  (image/jpeg)

so i dont no what its not working and if i have to add something to my code
so the images can load i am s desperate what i am doing wrong??
i am sorry for the trouble and if a dont explain my self very good jejeje


Rob Sargent-4 wrote:

Not at all sure what your problem is.  All I can do is show you what
works for us.

Our source xml looks like this:
image image-id=381623861 reference-id=ref-220 width=750
height=750 image-space-id=space-1 position=5
   image-pool-position=31 pos=4
   file=ref_10_1002108221  !-- an actual file (.jpeg
copied the working directory of the transformer --
fields /
caption /
annotations
arrow_positions origHeight=750 origWidth=750 /
/annotations
/image

Our xslt looks like this for each image needed.

xsl:template name=image
xsl:param name=img/  !-- This is the xml node from the source xml
above --
xsl:param name=width/
xsl:param name=height select=$width/
xsl:param name=ignoreHeightfalse/xsl:param
fo:block
fo:external-graphic src={$img/@file} height={$height}
width={$width} content-height=scale-to-fit
   content-width=scale-to-fit
border=0.5pt solid black border-collapse=separate
xsl:if test=$ignoreHeight != 'true'
xsl:attribute name=height
xsl:value-of select=$height/
/xsl:attribute
/xsl:if
/fo:external-graphic
/fo:block
/xsl:template

Our generated fo looks like this:
fo:table-cell
fo:block
fo:external-graphic border-collapse=separate border=0.5pt solid
black content-width=scale-to-fit content-height=scale-to-fit
width=2.5in height=2.5in src=ref_10_1002108221 /
/fo:block
/fo:table-cell

And the generated pdfs include the image and are shipped to the printer.

How does this stack up with what you have?


On 06/09/2011 01:19 PM, Oscar.Flores wrote:

Hi there well i still got the problem but searching IN INTERNET i find a
JPEG
renderer output for FOP its here

http://marc.info/?l=fop-userm=125986752706366w=2

the cuestion is can i render the image that i want to put in the pdf, and
then add to the xsl the render jpeg it will work??

and here explaints how use the render when he say uses fop as normal case
what does it mean
what else have to add to the code?? i hope you can help me

Thanks!!

// OutputStream out = what you want
  FopFactory fopFactory = FopFactory.newInstance();
  RendererFactory rendererFactory = null;
  FOUserAgent foUserAgent = null;

  rendererFactory = fopFactory.getRendererFactory();
  rendererFactory.addRendererMaker(new
MultiRendererMaker(jpeg));
  foUserAgent = fopFactory.newFOUserAgent();
  rendererFactory.createRenderer(foUserAgent, image/jpeg);

  Fop fop = fopFactory.newFop(image/jpeg, foUserAgent, out);

//Use fop as normal case


Rob Sargent-4 wrote:

Since you're now into xmlgraphics, I think you're best bet is here
http://xmlgraphics.apache.org/commons/image-loader.html

On 06/07/2011 10:18 AM, Oscar.Flores wrote:

Hi ok this is for generate images that dont need to be decompress
later??
and
the result image i put in my xsl ?? then it should work, aaa i change
to
fop
1.0 and xml communs 1.4 and its the same jejeje   dont find the image
preload

org.apache.fop.fo.flow.ExternalGraphic bind
SEVERE: Image not available: The file format is not supported. No
ImagePreloader for *.jpg or *.bmp


Rob Sargent-4 wrote:

ImageIO.write(bufferedImage, JPEG, file);

On 06/07/2011 08:21 AM, Oscar.Flores wrote:

Ok i actually register the handler now what i have to do is setup
this
handler or not?? and how can i do that, also it seem that the bmp its
not
recognice also what can i do?? thanks for the help rob
also i am trying to convert the images to see if it that helps


Rob Sargent-4 wrote:

On 06/06/2011 02:29 PM, Oscar.Flores wrote:

Hi what can be the difference between execute the program in
netbeans
(where
it works and print the images and the jar in the console)

Different classes being loaded by Netbeans than the console app.
Get
Netbeans to show you the full classpath it's using in it's
%classpath
variable

also i tried the
imageIO.getImageReadersBySuffix but i cant interpretate the data
y.y,
its
that or always its true 

How to determine which block are fo:table-row from XML-AT output?

2011-06-10 Thread Rob Sargent
Wondering if it's possible to programmatically  identify which blocks in 
the areatree output correspond to fo:table-row calls, given that the 
entire page is a single fo:table.




-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: flow sideways

2011-06-10 Thread Vincent Hennebert
Hi Rob,

(Sorry for the delay.)

On 01/06/11 00:30, Rob Sargent wrote:
 I have a table of data which is designed to span across two facing pages. 
 Thanks to the tip from Jeremias Maerki I can size the tables perfectly and
 allot the correct space in the region-before or each page. But how do I get
 the table to break across the two pages nicely?  Since the definition of
 each line's depth my be determined by any column I cannot lay the two halves
 out separately.  It would be cool if it would just flow nicely all by itself
 but that's not quite how flow works far as I know.  Perhaps I could lay the
 entire table in both region and have it truncate the left/right overflow? 

That seems to me like the best way to achieve what you want. Normally
you just have to play with start-indent and end-indent on the table. You
can even set the other indent (end-indent or start-indent) to a negative
value to avoid FOP warnings. Something like this:
• for even pages:
  fo:table table-layout=fixed width=200%
start-indent=0 end-indent=-100%
fo:table-header start-indent=0 end-indent=0
  ...
/fo:table-header
fo:table-body start-indent=0 end-indent=0
  ...
/fo:table-body
  /fo:table
• for odd pages:
  fo:table table-layout=fixed width=200%
start-indent=-100% end-indent=0
fo:table-header start-indent=0 end-indent=0
  ...
/fo:table-header
fo:table-body start-indent=0 end-indent=0
  ...
/fo:table-body
  /fo:table

(You may have to adjust the width of the table a bit to account for its
borders.)


 Seems possible for the left page, but would it work for the right hand page.
 i.e. Can one force the region to in essence fill from the right.
 
 Or is there a correct way to accomplish this?
 
 All pointer welcome,
 
 rjs

HTH,
Vincent

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: How to determine which block are fo:table-row from XML-AT output?

2011-06-10 Thread Vincent Hennebert
Hi Rob,

On 10/06/11 17:12, Rob Sargent wrote:
 Wondering if it's possible to programmatically  identify which blocks in the
 areatree output correspond to fo:table-row calls, given that the entire page
 is a single fo:table.

There’s no way AFAICT, as an fo:table-row element does not generate any
area. What exactly do you need to do?


Vincent

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: PDF/A-1a compliancy and PDF version 1.4

2011-06-10 Thread Vincent Hennebert
Hi Peder,

(Sorry for the delay.)

On 23/05/11 15:06, Peder wrote:
 Hi list,
 
 I have a question about the PDF/A-1a compliancy of the PDF that FOP produces.
 We produce PDF/A-1a compliant PDF for a customer of us. But I think there is 
 a problem with the tagging of tables.
 When PDF/A-1a is selected the PDF version needs to be 1.4 according to the 
 documentation. 
 But the renderer tries to output THead TBody and TFoot tags in the PDF for 
 the appropriate table elements. 
 Only the PDF 1.4 does not support THead, TBody and TFoot tags and  when the 
 PDF/A-1a compliancy is being tested, the three tags are being reported as 
 failures.
 Is this a bug?

Yes, an oversight when accessibility was implemented. Some standard
structure types appeared only in PDF 1.5.

You can override the default structure type assigned to each FO element
using the role attribute. In the case of table-header/footer/body you
would probably want to replace it with the generic Div structure type:
  fo:table-header role=Div ...
...

This should make your document 1.4-compliant again.

 
 Best regards,
 
 Peder

HTH,
Vincent

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: How to determine which block are fo:table-row from XML-AT output?

2011-06-10 Thread Rob Sargent

Thanks Vincent.
Related to the flow-sideways issue.  A stab at an alternative: was 
hoping grab to the block progression value of the row.


Consider this thread closed, though I find the news that fo:table-row 
calls don't generate area both enlightening and confusing.




On 06/10/2011 10:28 AM, Vincent Hennebert wrote:

Hi Rob,

On 10/06/11 17:12, Rob Sargent wrote:

Wondering if it's possible to programmatically  identify which blocks in the
areatree output correspond to fo:table-row calls, given that the entire page
is a single fo:table.

There’s no way AFAICT, as an fo:table-row element does not generate any
area. What exactly do you need to do?


Vincent

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: flow sideways

2011-06-10 Thread Rob Sargent

Vincent, thank you again.

You have probably solved this for me (once I truly grok the power of 
indent).


Cheers,
rjs


On 06/10/2011 10:23 AM, Vincent Hennebert wrote:

Hi Rob,

(Sorry for the delay.)

On 01/06/11 00:30, Rob Sargent wrote:

I have a table of data which is designed to span across two facing pages.
Thanks to the tip from Jeremias Maerki I can size the tables perfectly and
allot the correct space in the region-before or each page. But how do I get
the table to break across the two pages nicely?  Since the definition of
each line's depth my be determined by any column I cannot lay the two halves
out separately.  It would be cool if it would just flow nicely all by itself
but that's not quite how flow works far as I know.  Perhaps I could lay the
entire table in both region and have it truncate the left/right overflow?

That seems to me like the best way to achieve what you want. Normally
you just have to play with start-indent and end-indent on the table. You
can even set the other indent (end-indent or start-indent) to a negative
value to avoid FOP warnings. Something like this:
• for even pages:
   fo:table table-layout=fixed width=200%
 start-indent=0 end-indent=-100%
 fo:table-header start-indent=0 end-indent=0
   ...
 /fo:table-header
 fo:table-body start-indent=0 end-indent=0
   ...
 /fo:table-body
   /fo:table
• for odd pages:
   fo:table table-layout=fixed width=200%
 start-indent=-100% end-indent=0
 fo:table-header start-indent=0 end-indent=0
   ...
 /fo:table-header
 fo:table-body start-indent=0 end-indent=0
   ...
 /fo:table-body
   /fo:table

(You may have to adjust the width of the table a bit to account for its
borders.)



Seems possible for the left page, but would it work for the right hand page.
i.e. Can one force the region to in essence fill from the right.

Or is there a correct way to accomplish this?

All pointer welcome,

rjs

HTH,
Vincent

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: How to determine which block are fo:table-row from XML-AT output?

2011-06-10 Thread Rob Sargent

Hello Andreas,

Thanks for the clarification and spec. reference.

On 06/10/2011 10:49 AM, Andreas L. Delmelle wrote:

On 10 Jun 2011, at 18:40, Rob Sargent wrote:

Hi Rob


snip /
Consider this thread closed, though I find the news that fo:table-row calls 
don't generate area both enlightening and confusing.

It is literally defined so in the Recommendation: see Areas at 
http://www.w3.org/TR/xsl/#fo_table-row.

I can see what you mean.
It does make perfect sense, but from FOP perspective, also poses the challenge of 
properly implementing id on fo:table-row... Since there is no area to attach 
the id to, we currently have no location in the area tree that ref-ids can point to.


Regards

Andreas
---
-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: How to determine which block are fo:table-row from XML-AT output?

2011-06-10 Thread Christopher R. Maden
On 06/10/2011 12:49 PM, Andreas L. Delmelle wrote:
 It does make perfect sense, but from FOP perspective, also poses the
 challenge of properly implementing id on fo:table-row... Since
 there is no area to attach the id to, we currently have no location
 in the area tree that ref-ids can point to.

I hadn’t really thought about that.  But IMO, the ID ought to attach to
the first cell within the row.  More generically, if any FO element has
an ID but no area, the ID ought to attach to the first area generated by
any of its descendants.

That raises the possibility of a single area having multiple IDs... is
that a problem in PDF?

~Chris
-- 
Chris Maden, text nerd  URL: http://crism.maden.org/ 
“Before I built a wall I’d ask to know / What I was walling in or
 out, / And to whom I was like to give offence.” — RF, Mending Wall
GnuPG Fingerprint: C6E4 E2A9 C9F8 71AC 9724 CAA3 19F8 6677 0077 C319

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: How to determine which block are fo:table-row from XML-AT output?

2011-06-10 Thread Andreas L. Delmelle
On 10 Jun 2011, at 18:55, Christopher R. Maden wrote:

Hi Chris

 On 06/10/2011 12:49 PM, Andreas L. Delmelle wrote:
 It does make perfect sense, but from FOP perspective, also poses the
 challenge of properly implementing id on fo:table-row... Since
 there is no area to attach the id to, we currently have no location
 in the area tree that ref-ids can point to.
 
 I hadn’t really thought about that.  But IMO, the ID ought to attach to
 the first cell within the row.  More generically, if any FO element has
 an ID but no area, the ID ought to attach to the first area generated by
 any of its descendants.

Indeed! Just pondering over that here, too. Perhaps it's not that much of a 
challenge, after all.

 That raises the possibility of a single area having multiple IDs... is
 that a problem in PDF?

I don't think this is an issue. As far as I recall, the id is only used 
internally to track locations on pages. As far as PDF is concerned, if the id 
is never referenced, it does not result in anything even being written to the 
stream (unless a fox:destination is used to externalize it).

The area tree XML stores the specified id as a prod-id attribute. There can 
definitely be multiple areas with the same prod-id, as a block can be broken 
over multiple columns or pages. 
Since prod-id is FOP proprietary anyway, I don't immediately see anything 
against a convention of allowing this to be a separated list of producer-ids.



Regards

Andreas
---

-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Multi Threaded FOP?

2011-06-10 Thread Alexios Giotis
The last 6 months or so, it works pretty good for us in productions systems. We 
are using FOP 1.0 + a selection of patches that fix concurrency issues, for 
example see:

https://issues.apache.org/bugzilla/show_bug.cgi?id=50698
https://issues.apache.org/bugzilla/show_bug.cgi?id=46360
http://marc.info/?l=fop-userm=129646673801270w=2

Alexis


On Jun 9, 2011, at 11:26 AM, Theresa Jayne Forster wrote:

 I am looking into redoing my FOP integration and maybe adding it into some 
 form of MQ service,
 So many applications can request fop functionality and then have their 
 response sent on the MQQueue,
 How Threadsafe is the Fop engine? Or is the current newFopInstance from a 
 singleton factory instance totally threadsafe?
  
 Are there any catcha’s I need to be aware of?
  
 Kindest regards
  
 
 Theresa Forster
 Senior Software Developer
 
  


-
To unsubscribe, e-mail: fop-users-unsubscr...@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-h...@xmlgraphics.apache.org



Re: Problems with FOP and image

2011-06-10 Thread Oscar.Flores

You where absolutly rigth i miss a few libraries to add into the jar file, i
modified the build.xml to add the package and jar that i need, now the error
message is not there but still the images dont show in the pdf i remeber
that i do something in netbeans so they can add to the pdf but i cant
remeber i dont now if there is still a library that is missing or i am
adding more than it should be 
This is what i use :
cfdi-base-0.1.6-SNAPSHOT.jar 
guava-r09.jar
guava-r09-gwt.jar
jaxb-impl-2.1.10.jar
avalon-framework-api-4.3.jar
avalon-framework-cvs-20020806.jar
avalon-logkit-2.1.jar
not-yet-commons-ssl-0.3.11.jar
commons-codec-1.5.jar
commons-codec-1.5-sources.jar
log4j-1.2.16.jar
fop.jar
jdom.jar
xmlgraphics-commons-1.4.jar
commons-io-1.3.1.jar
fop-pdf-images-2.0.1.SNAPSHOT.jar
pdfbox-app-1.5.0.jar
fontbox-1.3.1.jar
jempbox-1.3.1.jar
xercesImpl-2.7.1.jar
batik-all-1.7.jar
xml-apis-1.3.04.jar
xml-apis-ext-1.3.04.jar
 avalon-framework-4.2.0.jar
 xalan-2.7.0.jar
 serializer-2.7.0.jar
 commons-logging-1.0.4.jar
 jai_codec.jar
 jai_core.jar 
 batik-ext.jar
 jai_imageio-1.1-sources.jar

Thanks Rob for the help
  

Rob Sargent-4 wrote:
 
 I suspect running from your jar does not have/use the same classpath 
 that is in effect while you're in the debugger.
 By what mechanism do you generate the jar?
 Is it an executable jar or are you running java -classpath 
 your-jar-here:other-jars Main?
 Make your IDE (netbeans) display the classpath  it uses to run your app 
 and compare that with the above.
 
 On 06/09/2011 07:21 PM, Oscar.Flores wrote:
 aaa ok well my problem is that when i do the pdf in netbean the pdf is
 fine
 with images and evething but when i run the jar file in command it give
 me a
 error

 GRAVE: Error while processing image: I:\cfd\rfc.jpg (image/jpeg)
   org.apache.xmlgraphics.image.loader.ImageException: Cannot load
   image (no suitable loader/converter combination available) for
 I:\cfd\rfc.jpg
   (image/jpeg)

 so i dont no what its not working and if i have to add something to my
 code
 so the images can load i am s desperate what i am doing wrong??
 i am sorry for the trouble and if a dont explain my self very good jejeje


 Rob Sargent-4 wrote:
 Not at all sure what your problem is.  All I can do is show you what
 works for us.

 Our source xml looks like this:
 image image-id=381623861 reference-id=ref-220 width=750
 height=750 image-space-id=space-1 position=5
image-pool-position=31 pos=4
file=ref_10_1002108221  !-- an actual file (.jpeg
 copied the working directory of the transformer --
 fields /
 caption /
 annotations
 arrow_positions origHeight=750 origWidth=750 /
 /annotations
 /image

 Our xslt looks like this for each image needed.

 xsl:template name=image
 xsl:param name=img/  !-- This is the xml node from the source xml
 above --
 xsl:param name=width/
 xsl:param name=height select=$width/
 xsl:param name=ignoreHeightfalse/xsl:param
 fo:block
 fo:external-graphic src={$img/@file} height={$height}
 width={$width} content-height=scale-to-fit
content-width=scale-to-fit
 border=0.5pt solid black border-collapse=separate
 xsl:if test=$ignoreHeight != 'true'
 xsl:attribute name=height
 xsl:value-of select=$height/
 /xsl:attribute
 /xsl:if
 /fo:external-graphic
 /fo:block
 /xsl:template

 Our generated fo looks like this:
 fo:table-cell
 fo:block
 fo:external-graphic border-collapse=separate border=0.5pt solid
 black content-width=scale-to-fit content-height=scale-to-fit
 width=2.5in height=2.5in src=ref_10_1002108221 /
 /fo:block
 /fo:table-cell

 And the generated pdfs include the image and are shipped to the printer.

 How does this stack up with what you have?


 On 06/09/2011 01:19 PM, Oscar.Flores wrote:
 Hi there well i still got the problem but searching IN INTERNET i find
 a
 JPEG
 renderer output for FOP its here

 http://marc.info/?l=fop-userm=125986752706366w=2

 the cuestion is can i render the image that i want to put in the pdf,
 and
 then add to the xsl the render jpeg it will work??

 and here explaints how use the render when he say uses fop as normal
 case
 what does it mean
 what else have to add to the code?? i hope you can help me

 Thanks!!

 // OutputStream out = what you want
   FopFactory fopFactory = FopFactory.newInstance();
   RendererFactory rendererFactory = null;
   FOUserAgent foUserAgent = null;

   rendererFactory = fopFactory.getRendererFactory();
   rendererFactory.addRendererMaker(new
 MultiRendererMaker(jpeg));
   foUserAgent = fopFactory.newFOUserAgent();
   rendererFactory.createRenderer(foUserAgent,
 image/jpeg);

   Fop fop = fopFactory.newFop(image/jpeg, foUserAgent,
 out);

 //Use fop as normal case


 Rob Sargent-4 wrote:
 Since you're now into xmlgraphics, I think you're best bet is here
 http://xmlgraphics.apache.org/commons/image-loader.html

 On 06/07/2011 10:18