Re: Re: how to extend the rendering part of fop

2011-01-03 Thread Stepan RYBAR
Hi, Eugen,

try to look for a minute on the XSL-T 2.0 library graph2svg, could be found 
on http://graph2svg.jinak.cz/examples_en.html;. It is pure XSL-T 2.0 from XML 
to SVG (when using two-phase transformation even inline SVG). The source XML 
code of graph2svg looks very similar to Your example code.

Cheers, Stepan

  Původní zpráva 
 Od: gen1986 cepoi.eu...@gmail.com
 Předmět: Re: how to extend the rendering part of fop
 Datum: 03.1.2011 20:34:39
 

 Hi Jeremias,

 Thanks for your quick response.
 However I'll give some more informations about what I'm trying to achieve.

 A sketch of the template :

 ... XSL-FO tags ...
 fo:instream-foreign-object...

 chart:chart xmlns:c=www...charts..
  c:pie width=.. height=..
  c:title value=Hello Piechart/
  ... some custom tags to retrieve data ...
 /c:pie
 /chart:chart

 ... XSL-FO tags ...

 My elementMapping extension handles those tags and creates my objects
 describing the chart.

 1) Actually I'm extending FONode, should I rather extend
 InstreamForeignObject?

 At some point (when the pdf is rendered) I'll use my objects to draw the
 chart to Graphics2D. But I will not create an Image.


 As you mentioned, it looks a lot like what you are doing here :
 [3]
 http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageConverterBarcode2G2D.java?revision=1.1view=markup

 So tell me if I'm wrong :
 I must implement Graphics2DImagePainter and AbstractImageConverter, I'll
 draw there my chart to the given Graphics2D. XMLGraphics will take care of
 integrating it into the doc (being created by fop).

 2) I must also extend AbstractImage, but for the moment I don't really
 understand what code to write there.

 To register the converter programatically :
 FopFactory factory = FopFactory.newInstance();
   
 factory.getImageManager().getRegistry().registerConverter(myG2DConverter);

 That sounds ok.
 3) But I don't understand how to make the link between my objects and the
 registred converter.


 Thanks again.

 Eugen



 Jeremias Maerki-2 wrote:
 
  Hi Eugen
 
  Assuming you're using Apache FOP 1.0 or later, I would suggest to you to
  write a set of plug-ins for the Apache XML Graphics Commons image loader
  framework. The documentation for that is found here:
  http://xmlgraphics.apache.org/commons/image-loader.html
 
  That's our new infrastructure for handling images. And your charting XML
  is nothing other than an image in XML. A good example of such a set of
  plug-ins can be found in Barcode4J:
 
 http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/
 
  You can see multiple ImageConverter implementations there. One converts
  [1] a generic XML document into an ImageBarcode [2]. And you would
  create something like an ImageChart. Furthermore, I'd go the Java2D
  route (Graphics2D), so you'd add an ImageConverter which takes an
  ImageChart and produces an ImageGraphics2D [3] (The code in there
  basically paints your chart against a Graphics2D object). The latter can
  be processed by FOP's PDF support to create high-quality vector graphics
  without you having to learn about PDF specifics. The nice side-effect is
  that it won't only work for PDF, but also for all other output formats
  supported by FOP.
 
  [1]
 
 http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageConverterBarcodeXML2Barcode.java?view=markup
  [2]
 
 http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageBarcode.java?view=markup
  [3]
 
 http://barcode4j.cvs.sourceforge.net/viewvc/barcode4j/barcode4j/src/xmlgraphics-commons/java/org/krysalis/barcode4j/image/loader/ImageConverterBarcode2G2D.java?view=markup
 
  If you don't plan to put charts in external files (i.e. you use only
  fo:instream-foreign-object), you can omit the Preloader, LoaderFactory
  and Loader, I think. The image converters should be enough.
 
  If there's something that our PDFGraphics2D can't handle, we can take a
  closer look at this again.
 
  HTH
 
  On 03.01.2011 16:55:32 gen1986 wrote:
 
  Hi,
 
  I'm working on a project where I have to extend FO to support custom tags
  for drawing charts.
  For doing so I've extended ElementMapping and created my custom
  ContentHandlerFactory, etc.
  Until here it's ok. I can get all the infos about the chart from the
  xsl-fo
  template.
 
  My problem is that I want now to write the chart as a stream to the PDF,
  but
  I don't know which fop classes to use for doing it the right way. Any
  help
  is welcome.
 
  If my problem isn't clear enough I can give more explanations, just let
  me
  know ;)
 
  Thanks,
 
  Eugen
  --
  View this message in context:
 
 

Re: RE: 3D charts and FOP 1.0

2010-12-28 Thread Stepan RYBAR
Hi, I played with graph2svg library (made by Jakub Vojtisek) some time ago. 
It could be found on http://graph2svg.jinak.cz/examples_en.html;. It supports 
also 3D graphs (although, I do not prefere 3D ones) and its advatnage is, that 
SVG is created from XML using XSL-T 2.0, no Java external code (version of 
Saxon with support of some extension is required, afaik - so You have to use 
older Saxon B or newer SaxonPE, I guess). Newer version of this library is 
maintained on http://www.dpawson.co.uk/graph2svg/; by Dave Pawson. Stepan


  Původní zpráva 
 Od: Eric Douglas edoug...@blockhouse.com
 Předmět: RE: 3D charts and FOP 1.0
 Datum: 28.12.2010 14:03:51
 
 I use SVG for 2D charts.
 There is also a free Java library called JFreeChart which also claims to
 do 3D charts.


 -Original Message-
 From: Jayant Ghagre [mailto:jayant.gha...@ambest.com]
 Sent: Friday, December 24, 2010 12:43 PM
 To: fop-users@xmlgraphics.apache.org
 Subject: 3D charts and FOP 1.0

 We are generating PDF reports by retrieving data in XML format from
 Oracle
 (11gR2) database. Java Servlet generates the PDF using the XML data and
 XSLT.

 I would like to know fop-user's experience in generating 3D charts with
 XSL-FO.

 Did you use SVG to generate 3D charts? Any other option?
 What were the technical issues related to generating 3D charts and
 including them in PDF report?

 Thanks for your help.


 Jayant



 -
 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





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



How to XSL-T transform IntermediateFormat within FOP?

2010-12-27 Thread Stepan RYBAR
Hello, 

is it possible to perform XSL-T (2.0) transformation within FOP (1.0), *where 
input file is in IntermediateFormat*? I tried it, but without success 
(something like unable to mix input mode). It is not question how to configure 
FOP together with Saxon. I can do that successfully when input file is in XML 
format: 

fop -xml in.xml -xsl transA.xsl -if someMime out.if 

I need to perform some XSL-T (it has to be 2.0 - with Saxon9HE) on above 
created IF output (calculate relative and absolute page count within one IF 
file). Currently I do this separately using Saxon for XSL-T transformation of 
old IF to new IF and then using FOP for transformation of new IF to final PDF. 
But because file is quite large (90 MB) and there are IO costs and parsing 
costs, I guess, that it would be more effective to do something like 

fop -if out.if -xsl transB.xsl -pdf out.pdf 

Because IF is XML, it should be possible, am I right? Question is, how 
effective it could be, when Saxon, I guess, uses different internal 
representation of XML (TinyTree) than FOP does (I do not have any hints about 
internals of FOP). 

Thank You for Your answer. Stepan 

P.S. I think, that it could be nice to add to the documentation step-by-step or 
example how to use Saxon for XSL-T 2.0 transformation within FOP. It took me 
lot of time before I found according to the 
http://www.mail-archive.com/fop-dev@xmlgraphics.apache.org/msg10258.html;, 
that Saxon (saxon9he.jar) has to be set (added) in fop.bat in 
LOCALCLASSPATH before (commented) Xalan (xalan-2.7.0.jar). 


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



How to create Intermediate Format and then PDF on command line?

2010-02-01 Thread Stepan RYBAR
Hello,

I have discovered Apache FOP intermediate format features just now. It looks 
like this could solve my problem with custom element based on fo:page-number/ 
sent to conference of Friday, because intermediate format is already page 
defined and editable format, so I guess, I can easily count preceding-sibling 
to get absolute page position of current page and change some value within 
intermediate format. Am I right?

I guess, that I should be aware to do changes just withing box model of changed 
element - to ensure not to overflow its box, am I right?

Another ask - after reading documentation, command-line hints etc. I am able to 
generate just only AreaTreeFormat, not the new IntermediateFormat. Could You be 
so kind and write m two commands: how to generate IF for ODF output and how to 
generate PDF from IF?

The last ask - is IntermediateFormat and (or) AreaTreeFormat production ready 
now or will be in the near future? Can I rely on it in production environment?

Thank You. Stepan


  Původní zpráva 
 Od: Stepan RYBAR xryb...@seznam.cz
 Předmět: Where to do changes in source of fo:page-number/ or how to write my
 custom element based on fo:page-number/?
 Datum: 28.1.2010 17:41:47
 
 Hello,

 I need to change behavior of fo:page-number/ like any modulo division,
 multiplication, additions etc. Originally I planned to write my custom 
 element,
 but I did not found any relevant information how to do that. So the easiest 
 way
 I guessed to write modification of fo:page-number/. Could You please point 
 me
 to the Java code of FOP, where is fo:page-number/ calculated and returned?

 Or better and cleaner and sophisticated approach: Is there any document how to
 write my custom element (based on fo:page-number/ code)? My custom code 
 should
 looks like myCustomElement:barCode addThisNumber=some XPath calculated from
 XML/ and should do something like (this is not any programming language code
 ;-)

 int barCode
 int pageNumber = fo:page-number/

 switch pageNumber
 case 1 barCode = 
 case N barCode = ...
 case 31 barCode = ...

 return barCode+addThisNumber

 Thank You in advance for Your hints, code examples, etc. Stepan

 -
 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 create Intermediate Format and then PDF on command line?

2010-02-01 Thread Stepan RYBAR
 Another ask - after reading documentation, command-line hints etc. I am able 
 to
 generate just only AreaTreeFormat, not the new IntermediateFormat. Could You 
 be
 so kind and write m two commands: how to generate IF for ODF output and how to
 generate PDF from IF?

...I am sorry, I read documentation of Trunk version of FOP and used 0.95. My 
fault in this point. Stepan

  Původní zpráva 
 Od: Stepan RYBAR xryb...@seznam.cz
 Předmět: How to create Intermediate Format and then PDF on command line?
 Datum: 01.2.2010 18:16:41
 
 Hello,

 I have discovered Apache FOP intermediate format features just now. It looks
 like this could solve my problem with custom element based on 
 fo:page-number/
 sent to conference of Friday, because intermediate format is already page
 defined and editable format, so I guess, I can easily count preceding-sibling
 to get absolute page position of current page and change some value within
 intermediate format. Am I right?

 I guess, that I should be aware to do changes just withing box model of 
 changed
 element - to ensure not to overflow its box, am I right?

 Another ask - after reading documentation, command-line hints etc. I am able 
 to
 generate just only AreaTreeFormat, not the new IntermediateFormat. Could You 
 be
 so kind and write m two commands: how to generate IF for ODF output and how to
 generate PDF from IF?

 The last ask - is IntermediateFormat and (or) AreaTreeFormat production ready
 now or will be in the near future? Can I rely on it in production environment?

 Thank You. Stepan


   Původní zpráva 
  Od: Stepan RYBAR xryb...@seznam.cz
  Předmět: Where to do changes in source of fo:page-number/ or how to write
 my
  custom element based on fo:page-number/?
  Datum: 28.1.2010 17:41:47
  
  Hello,
 
  I need to change behavior of fo:page-number/ like any modulo division,
  multiplication, additions etc. Originally I planned to write my custom
 element,
  but I did not found any relevant information how to do that. So the easiest
 way
  I guessed to write modification of fo:page-number/. Could You please point
 me
  to the Java code of FOP, where is fo:page-number/ calculated and returned?
 
  Or better and cleaner and sophisticated approach: Is there any document how
 to
  write my custom element (based on fo:page-number/ code)? My custom code
 should
  looks like myCustomElement:barCode addThisNumber=some XPath calculated 
  from
  XML/ and should do something like (this is not any programming language
 code
  ;-)
 
  int barCode
  int pageNumber = fo:page-number/
 
  switch pageNumber
  case 1 barCode = 
  case N barCode = ...
  case 31 barCode = ...
 
  return barCode+addThisNumber
 
  Thank You in advance for Your hints, code examples, etc. Stepan
 
  -
  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





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



What is the fastest way to create 100.000 unique PDFs?

2009-10-09 Thread Stepan RYBAR
Hallo! 

I am looking for the fastest way to create 100.000 unique PDFs. I have 10 
unique XML files per 25 MB (result of output from SQL database), each one 
contains data for unique 10.000 letters. I have to create 100.000 letters in 
PDF per 1 or 2 pages. Now I am doing it in following way: 

1) For each of 10 XML file do XSL-T 2.0 using Saxon 9.2, which produces 100.000 
FO files per 4 to 7 kB. Technically I am doing it by 10 times call of XSL-T 
using Saxon, which split input using xsl:result-document 2.0 instruction. This 
is fast enough for me, it takes about 18 minutes. 

2) Now the painfull process. For each of 100.000 FO file do FO to PDF using 
Apache FOP 0.95, which produce 100.000 PDF files per few kB. Technically I am 
doing it by 100.000 times call of FO to PDF using Apache FOP. I guess, that the 
problem is time for starting and closing Apache FOP from command line. Is there 
any other efficient way, how to do it? Like to specify not input exact file, 
but wildcarded filename. Of have I do some Java programming with Apache FOP? Or 
can Apache FOP do some kind of splitting output? 

I tried to solve it by parallel transformation using 

for %%f in (*0.fo) do fop... 
for %%f in (*1.fo) do fop... 
for %%f in (*2.fo) do fop... 
... 
in separate batches. 

because my files is named sequentionNumber.fo to be able to utilize more cores, 
but it should have the right effect on 10+ cores computers. Utilisation of 
cores is 100 %, RAM is OK. 

I am using Sun Java 1.6.0_05 on MS Windows Vista 32bit Enterprise, Intel Core2 
6600 at 2.4 GHz, 2.0 GB RAM, java -Xmx=128m. 

Thank You for help in advance. Stepan

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



Re: 0.95: How to insert static text to the last page of sequence?

2008-11-11 Thread Stepan RYBAR
Ehm, I want to add this static text to the precise position of the page 
(xsl-region after left=10pt top=10pt), not to the end of flow of 
xsl-region-body. It should be barcode of inserting machine. Stepan

  Původní zpráva 
 Od: Stepan RYBAR [EMAIL PROTECTED]
 Předmět: 0.95: How to insert static text to the last page of sequence?
 Datum: 11.11.2008 15:20:16
 
 Hello!

 I am using Apache FOP 0.95 and I have a problem how to insert some static text
 to the last page of page sequence. In case of multiple pages document, it 
 works
 OK. But in case of single page document, FOP says, that the only one page is 
 ANY
 page and not the LAST page. The same logic with the FIRST page works OK. I
 guess, that more specific (better matching) position should be taken as with 
 the
 higher precedence. Can You help me, please? See attached FO with my problem. I
 also tried proposed solution from
 http://services.renderx.com/lists/xep-support/3856.html;, but it does not 
 work
 me using FOP 0.95.

 Thank You in advance, Stepan




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



0.95: How to insert static text to the last page of sequence?

2008-11-11 Thread Stepan RYBAR
Hello!

I am using Apache FOP 0.95 and I have a problem how to insert some static text 
to the last page of page sequence. In case of multiple pages document, it works 
OK. But in case of single page document, FOP says, that the only one page is 
ANY page and not the LAST page. The same logic with the FIRST page works OK. I 
guess, that more specific (better matching) position should be taken as with 
the higher precedence. Can You help me, please? See attached FO with my 
problem. I also tried proposed solution from 
http://services.renderx.com/lists/xep-support/3856.html;, but it does not work 
me using FOP 0.95. 

Thank You in advance, Stepan 
?xml version=1.0 encoding=utf-8?
fo:root xmlns:fo=http://www.w3.org/1999/XSL/Format;
  fo:layout-master-set
fo:simple-page-master master-name=lastPage page-height=29.7cm page-width=21.0cm margin=2cm
  fo:region-body margin=2cm /
  fo:region-before extent=2cm /
  fo:region-after region-name=lastPage extent=2cm /
/fo:simple-page-master
fo:simple-page-master master-name=firstPage page-height=29.7cm page-width=21.0cm margin=2cm
  fo:region-body margin=2cm /
  fo:region-before extent=2cm /
  fo:region-after region-name=firstPage extent=2cm /
/fo:simple-page-master
fo:simple-page-master master-name=anyPage page-height=29.7cm page-width=21.0cm margin=2cm
  fo:region-body margin=2cm /
  fo:region-before extent=2cm /
  fo:region-after region-name=anyPage extent=2cm /
/fo:simple-page-master
fo:page-sequence-master master-name=chapter
  fo:repeatable-page-master-alternatives
!-- to try it, just switch between commenting line 23 and 25 --
!-- page-position=last does NOT works as I want. --
!--fo:conditional-page-master-reference page-position=last master-reference=lastPage/--
!-- page-position=first does works as I want. --
fo:conditional-page-master-reference page-position=first master-reference=firstPage/
fo:conditional-page-master-reference page-position=any master-reference=anyPage/
  /fo:repeatable-page-master-alternatives
/fo:page-sequence-master
  /fo:layout-master-set
  fo:page-sequence master-reference=chapter
fo:static-content flow-name=lastPage
  fo:blockTHIS IS THE LAST PAGE./fo:block
/fo:static-content
fo:static-content flow-name=firstPage
  fo:blockTHIS IS THE FIRST PAGE./fo:block
/fo:static-content
fo:static-content flow-name=anyPage
  fo:blockTHIS IS ANY PAGE./fo:block
/fo:static-content
fo:flow flow-name=xsl-region-body
  !--fo:blockMulti page text. It behaves as I want. Add another words to create multi page text./fo:block--
  fo:blockSingle page text. It behaves as I do not want./fo:block
/fo:flow
  /fo:page-sequence
/fo:root
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

0.95: Metadata is not valid XML document even if there are no metadata defined in FO source

2008-11-05 Thread Stepan RYBAR
Hello,

I have a problem with metadada part of PDF created by Apache FOP 0.95 (using 
Sun Java SE 1.6.0_10 on MS Windows 2000). Although resulted PDF looks OK in 
Acrobat Reader, I am not able to process resulted PDF using iText 2.1.3. It 
throws Exception shown below. After several e-mails among iText developers (and 
me), it looks like even if I do not specify any metadata in FO, FOP 0.95 
produces PDF with compressed not valid XML metadata section according to iText 
developers. If I specify metadata according to Your example at

http://xmlgraphics.apache.org/fop/0.95/metadata.html#xmp-example

there is the same Exception. So, could You, please, verify, if the problem is 
really caused by FOP and if yes, to repait it? Thank You very much in advance.

Stepan Rybar

  Původní zpráva 
 Od: Paulo Soares 
 Předmět: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
 sequence Exception while processing PDF from Apache FOP 0.95
 Datum: 05.11.2008 15:44:00
 
 The metadata can be compressed, the problem is that the metadata is not a 
 valid
 xml document (or at least it wasn't in the pdf I loooked at). iText should
 ignore the error and carry on but it currently doesn't. The problem starts at
 FOP in any case.

 Paulo

 
 From: 1T3XT info []
 Sent: Wednesday, November 05, 2008 2:08 PM
 To: Post all your questions about iText here
 Subject: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
 sequence Exception while processing PDF from Apache FOP 0.95

 Stepan RYBAR wrote:
  Hello,
 
  thank You answer. But after some tests I guess, that this is not caused by
 missing metadata.

 Think again.

  Even if there are no metadata in source.fo

 Look at your PDF document.
 In the root dictionary, there's a reference to XMP data.
 /Metadata 7 0 R
 If we have a look at object 5, we see:
 7 0 obj
 
/Type /Metadata
/Subtype /XML
/Length 12 0 R
/Filter /FlateDecode
  
 stream
 xoe?QN~jÂ0?}?ü++?×?I??3¤.a){q??÷\??oem?#?Ú?öIu^...??
 W+OE=?îÍ9'ç#?u.Ë=X´...?]Ä?óý?#­bü?Íé1/4šÁNß7?VÍA~Z6{9Qxšô{ýž¨y}¨?`s?
 ?žu`2ÍÂ~ÂQ?]Y]?¨Ýómy^(2)1?-^^(1)}'f?0G?'l8?¤s?X?T'
 ^(1)s?wEUR^(2)Ç?o`?D++E`ë?Ë(c)HÇü/yÜ/[EMAIL 
 PROTECTED]'^(1)?ôvA`?EURFk6âa~?ÎFWqJ?é0yé§$W^?B+x
 a~?3/4äî?ÁO~ëE`U`s??!gÍ??.}??...kU^?Z?

 Oops... What's this?
 This is a compressed XMP stream.
 That's not allowed in PDF!



#  Původní zpráva 
# Od: Stepan RYBAR 
# Předmět: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
# sequence Exception while processing PDF from Apache FOP 0.95
# Datum: 05.11.2008 13:52:34
# 
# Hello,
#
# thank You answer. But after some tests I guess, that this is not caused by
# missing metadata. Even if there are no metadata in source.fo, I can use 
iText
# to print to stdout total number of pages. So it means, that iText can read
# source.pdf without throwing any exception. See attached source.fo 
(commented
# metadata), source.pdf (commented creation of output) and Java code for 
iText,
# which passes without problem.
#
# Once I want to create output file and save it without any modification (to
# prevent mistake in font encoding setting), there is an Exception:
#
# ExceptionConverter:
# com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException:
# Invalid byte 1 of 1-byte UTF-8 sequence.
#
# Stepan Rybar
#
#   Původní zpráva 
#  Od: Paulo Soares 
#  Předmět: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
#  sequence Exception while processing PDF from Apache FOP 0.95
#  Datum: 04.11.2008 17:23:03
#  
#  The metadata generated by FOP is broken. They have:
# 
#  x:xmpmeta
# 
#  instead of:
# 
#  x:xmpmeta xmlns:x=adobe:ns:meta/ x:xmptk=3.1-702
# 
#  The namespace is not defined and the parser complains about it.
# 
#  Paulo
#  
#  From: Stepan RYBAR []
#  Sent: Tuesday, November 04, 2008 4:11 PM
#  To: [EMAIL PROTECTED]
#  Subject: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
# sequence
#  Exception while processing PDF from Apache FOP 0.95
# 
#  Hello,
# 
#  I am trying to use iText for adding page numbers to the already existed PDF
#  using PDFStamper class. I have problem. PDFs, which I create using Apache 
FOP
#  0.95, cause Exception as shown below, although they look OK in Adobe Acrobat
#  Reader 8.1.2. I guess, that this is problem of missing or wrong encoding
#  somewhere (but where?). Attached to this e-mail are: FO source, resulted 
PDF,
#  Java code for iText. I am using Sun Java SE 1.6.0_10 on MS Windows 2000.
# Please,
#  can You point me, where I am making miskate?
# 
#  Thank You. Stepan
# 
#  L:\Documents\Capitol\vypisyKv1\_otherL:\RunFiles\jdk\jre\bin\java -cp
#  .;iText-
#  2.1.3.jar AddPageNumbersToExistingPageNumberPDF
#  ExceptionConverter

Re: 0.95: Metadata is not valid XML document even if there are no metadata defined in FO source

2008-11-05 Thread Stepan RYBAR
ad 1) I did it, it looks like it works.

ad 2)  ...you're using a JAXP TraX... You are right. Although I do not know, 
that (and even how to) I changed anything about JAXP, when I run this on my 
second comp (MS Windows Vista 64-bit Enterprise, Sun Java 64-bit 1.6.0_10-b33), 
it works fine.

Thank You. Stepan

  Původní zpráva 
 Od: Jeremias Maerki [EMAIL PROTECTED]
 Předmět: Re: 0.95: Metadata is not valid XML document even if there are no
 metadata defined in FO source
 Datum: 05.11.2008 17:51:56
 
 Ok, so we have two problems:
 1. Compressed Metadata stream: FOP doesn't compress the metadata stream
 by default. The problem is that FOP 0.95 has a demo configuration file
 that contains a filter list that causes all stream to be compressed.
 Please remove all filterList elements including their children from
 the configuration file. I've already committed a fix to FOP Trunk which
 makes this unnecessary some time ago:
 http://svn.apache.org/viewvc?rev=695491view=rev

 2. The XMP is not valid RDF because the namespace declarations are
 missing: If that happens you're using a JAXP TraX implementation that
 has a buggy serializer. I've just tried with a fresh Sun Java 1.6.0_10
 installation on WinXP and didn't have that problem. I assume you've
 installed a different JAXP implementation.

 On 05.11.2008 16:28:54 Stepan RYBAR wrote:
  Hello,
 
  I have a problem with metadada part of PDF created by Apache FOP 0.95
  (using Sun Java SE 1.6.0_10 on MS Windows 2000). Although resulted PDF
  looks OK in Acrobat Reader, I am not able to process resulted PDF using
  iText 2.1.3. It throws Exception shown below. After several e-mails
  among iText developers (and me), it looks like even if I do not specify
  any metadata in FO, FOP 0.95 produces PDF with compressed not valid XML
  metadata section according to iText developers. If I specify metadata
  according to Your example at
 
  http://xmlgraphics.apache.org/fop/0.95/metadata.html#xmp-example
 
  there is the same Exception. So, could You, please, verify, if the
  problem is really caused by FOP and if yes, to repait it? Thank You
  very much in advance.
 
  Stepan Rybar
 
    Pùvodní zpráva 
   Od: Paulo Soares 
   Pøedmìt: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
   sequence Exception while processing PDF from Apache FOP 0.95
   Datum: 05.11.2008 15:44:00
   
   The metadata can be compressed, the problem is that the metadata is not a
 valid
   xml document (or at least it wasn't in the pdf I loooked at). iText should
   ignore the error and carry on but it currently doesn't. The problem starts
 at
   FOP in any case.
  
   Paulo
  
   
   From: 1T3XT info []
   Sent: Wednesday, November 05, 2008 2:08 PM
   To: Post all your questions about iText here
   Subject: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8
   sequence Exception while processing PDF from Apache FOP 0.95
  
   Stepan RYBAR wrote:
Hello,
   
thank You answer. But after some tests I guess, that this is not caused
 by
   missing metadata.
  
   Think again.
  
Even if there are no metadata in source.fo
  
   Look at your PDF document.
   In the root dictionary, there's a reference to XMP data.
   /Metadata 7 0 R
   If we have a look at object 5, we see:
   7 0 obj
   
  /Type /Metadata
  /Subtype /XML
  /Length 12 0 R
  /Filter /FlateDecode

   stream
   xoe?QN~jÂ0?}?ü++?×?I??3¤.a){q??÷\??oem?#?Ú?öIu^...??
   W+OE=?îÍ9'ç#?u.Ë=X´...?]Ä?óý?#­bü?Íé1/4šÁNß7?VÍA~Z6{9Qxšô{ýž¨y}¨?`s?
   ?žu`2ÍÂ~ÂQ?]Y]?¨Ýómy^(2)1?-^^(1)}'f?0G?'l8?¤s?X?T'
  
 ^(1)s?wEUR^(2)Ç?o`?D++E`ë?Ë(c)HÇü/yÜ/[EMAIL 
 PROTECTED]'^(1)?ôvA`?EURFk6âa~?ÎFWqJ?é0yé§$W^?B+x
   a~?3/4äî?ÁO~ëE`U`s??!gÍ??.}??...kU^?Z?
  
   Oops... What's this?
   This is a compressed XMP stream.
   That's not allowed in PDF!
  
 
 
  #  Pùvodní zpráva 
  # Od: Stepan RYBAR 
  # Pøedmìt: Re: [iText-questions] iText 2.1.3: Invalid byte 1 of 1-byte UTF-8

  # sequence Exception while processing PDF from Apache FOP 0.95
  # Datum: 05.11.2008 13:52:34
  # 
  # Hello,
  #
  # thank You answer. But after some tests I guess, that this is not caused by
  # missing metadata. Even if there are no metadata in source.fo, I can use
 iText
  # to print to stdout total number of pages. So it means, that iText can read
  # source.pdf without throwing any exception. See attached source.fo
 (commented
  # metadata), source.pdf (commented creation of output) and Java code for
 iText,
  # which passes without problem.
  #
  # Once I want to create output file and save it without any modification (to
  # prevent mistake in font encoding setting), there is an Exception:
  #
  # ExceptionConverter:
  # com.sun.org.apache.xerces.internal.impl.io.MalformedByteSequenceException