RE: Hair ripping time

2011-06-06 Thread Theresa Jayne Forster
Yes but its jumping out from the line 
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

So if I am stepping through the code, I hit that line, press F8 for step
over , and its on the finally 
So the code is jumping from that line all the way out missing all the other
lines and not getting caught even though I am trying to catch every
exception  (to try and debug this - not as a normal thing btw) 
With catch (Exception ex)


Kindest regards


Theresa Forster
Senior Software Developer

-Original Message-
From: Rob Sargent [mailto:rsarg...@xmission.com] 
Sent: 03 June 2011 18:07
To: fop-users@xmlgraphics.apache.org
Subject: Re: Hair ripping time

That print statement will always be called since it's in the finally block.

On 06/03/2011 09:27 AM, Theresa Jayne Forster wrote:
 This makes no sense its crashing out with no error on this line
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 And it jumps straight to
System.out.print(*);

 The code I am using is as follows

 public File generatePDFFromXml(File xslFile,File xmlFile) {
  FopFactory fopFactory = FopFactory.newInstance();
  BufferedOutputStream out = null;
  File tempFile = null;
  try {
  fopFactory.setStrictValidation(false);
  DefaultConfigurationBuilder cfgBuilder = new
 DefaultConfigurationBuilder();
  Configuration cfg = cfgBuilder.buildFromFile(new
 File(fopconfig.xml));
  fopFactory.setUserConfig(cfg);

  tempFile = File.createTempFile(W2P, .pdf);
  out = new BufferedOutputStream(new
FileOutputStream(tempFile));
  FOUserAgent useragent= fopFactory.newFOUserAgent();
  useragent.setOutputFile(tempFile);
  useragent.setTargetResolution(300);
  Fop fop =
 fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
  TransformerFactory factory =
TransformerFactory.newInstance();
  Source xslt = new StreamSource(xslFile);
  Transformer transformer = factory.newTransformer(xslt);
  Source src = new StreamSource(xmlFile);
  Result res = new SAXResult(fop.getDefaultHandler());
  transformer.transform(src, res);
 out.flush();
 out.close();
  System.out.println(Output File =
+tempFile.getAbsolutePath());
  }  catch (TransformerConfigurationException ex) {
  ex.printStackTrace();
  } catch (TransformerException ex) {
  ex.printStackTrace();
  } catch (FOPException ex) {
  ex.printStackTrace();
  } catch (FileNotFoundException ex) {
  ex.printStackTrace();
 } catch (IOException ex) {
  ex.printStackTrace();
  } catch (Exception ex) {
  ex.printStackTrace();
  } finally {
  try {
System.out.print(*);
  out.close();
 } catch (IOException ex) {
  }
  }
  return tempFile;
  }

 Kindest regards


 Theresa Forster
 Senior Software Developer

 ther...@inbrand.co.uk
 www.inbrand.co.uk

 Tel: 01483 266500



 IMPORTANT NOTE: This transmission has been sent by or on behalf of In
Brand
 Software Ltd. The information in this transmission is for the intended
 addressee only and is confidential to that intended addressee. If either
you
 know or you ought reasonably to conclude that you are not, or may not be,
 the intended addressee, you are hereby given notice that any unauthorised
 dissemination or copying of this transmission and any disclosure or use of
 the information
 transmitted is strictly prohibited and may be illegal. In such
circumstances
 we ask for your assistance in notifying us immediately by e-mail,
telephone
 or letter.

 InBrand Software Ltd Registered in England No. 5131004 Registered Office:
 The Old Barn, Ewhurst Road, Cranleigh GU6 7EF


 -Original Message-
 From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk]
 Sent: 03 June 2011 15:42
 To: fop-users@xmlgraphics.apache.org
 Subject: RE: Hair ripping time

 Tried that same result, it jumps immediately out of the try catch into the
 finally

 Kindest regards


 Theresa Forster
 Senior Software Developer

 Seems like you need:

 Transformer transformer = factory.newTransformer();
 transformer.transform(new StreamSource(inputFO));


 HTH!

 Regards

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

 -
 No virus found in this message.
 Checked by AVG - www.avg.com
 Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
 Internal Virus Database is out of date.



 -
 To unsubscribe, e-mail: fop-users

RE: Hair ripping time

2011-06-06 Thread Theresa Jayne Forster
Thanks for that, it has improved my debugging but it seems to be implying an
issue with FOP

java.lang.NoSuchMethodError:
org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter()Lorg/apache
/commons/io/filefilter/IOFileFilter;
at
org.apache.fop.fonts.autodetect.FontFileFinder.getFileFilter(FontFileFinder.
java:79)
at
org.apache.fop.fonts.autodetect.FontFileFinder.init(FontFileFinder.java:52
)
at org.apache.fop.fonts.FontDetector.detect(FontDetector.java:69)
at
org.apache.fop.fonts.FontInfoConfigurator.configure(FontInfoConfigurator.jav
a:92)

Kindest regards


Theresa Forster
Senior Software Developer

-Original Message-
From: Andreas L. Delmelle [mailto:andreas.delme...@telenet.be] 
Sent: 03 June 2011 21:54
To: fop-users@xmlgraphics.apache.org
Subject: Re: Hair ripping time

On 03 Jun 2011, at 17:27, Theresa Jayne Forster wrote:

Hi Theresa

 This makes no sense its crashing out with no error on this line
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 And it jumps straight to 
  System.out.print(*);
snip /
}  catch (TransformerConfigurationException ex) {
ex.printStackTrace();
} catch (TransformerException ex) {
ex.printStackTrace();
} catch (FOPException ex) {
ex.printStackTrace();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
   } catch (IOException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();

Not as a general practice, but if all else fails:

} catch (Throwable t) {
t.printStackTrace();
}

Hopefully, that will reveal what is happening here.


Regards

Andreas
---

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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



Re: Hair ripping time

2011-06-06 Thread Michael Rubin

Sounds like a possible classpath issue to me? Do you have commons-io-*.jar on 
your system? And if so, is it in your classpath? Does adding it to your 
classpath help?

Thanks to a google search, 
http://javacio.us/search?q=org%2Fapache%2Fcommons%2Fio%2Ffilefilter%2FIOFileFilter+more%3Ajar_filesinline=true
 appears to point out which jars contain the file and where they can be retrieved 
from if required, although I have not tested the links.

Thanks.

-Mike


On 06/06/11 09:25, Theresa Jayne Forster wrote:

Thanks for that, it has improved my debugging but it seems to be implying an
issue with FOP

java.lang.NoSuchMethodError:
org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter()Lorg/apache
/commons/io/filefilter/IOFileFilter;
 at
org.apache.fop.fonts.autodetect.FontFileFinder.getFileFilter(FontFileFinder.
java:79)
 at
org.apache.fop.fonts.autodetect.FontFileFinder.init(FontFileFinder.java:52
)
 at org.apache.fop.fonts.FontDetector.detect(FontDetector.java:69)
 at
org.apache.fop.fonts.FontInfoConfigurator.configure(FontInfoConfigurator.jav
a:92)

Kindest regards


Theresa Forster
Senior Software Developer






Michael Rubin
Developer

T: +44 20 8238 7400
F: +44 20 8238 7401

mru...@thunderhead.com

The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us 
immediately and then destroy it. 





-Original Message-

From: Andreas L. Delmelle [mailto:andreas.delme...@telenet.be]
Sent: 03 June 2011 21:54
To: fop-users@xmlgraphics.apache.org
Subject: Re: Hair ripping time

On 03 Jun 2011, at 17:27, Theresa Jayne Forster wrote:

Hi Theresa


This makes no sense its crashing out with no error on this line
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
And it jumps straight to
  System.out.print(*);

snip /

}  catch (TransformerConfigurationException ex) {
ex.printStackTrace();
} catch (TransformerException ex) {
ex.printStackTrace();
} catch (FOPException ex) {
ex.printStackTrace();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
   } catch (IOException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();

Not as a general practice, but if all else fails:

 } catch (Throwable t) {
 t.printStackTrace();
 }

Hopefully, that will reveal what is happening here.


Regards

Andreas
---

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



-
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: Hair ripping time

2011-06-06 Thread Theresa Jayne Forster
I am running it under Apache Tomcat but I also have commons-io-1.3.2.jar in the 
Netbeans Libraries folder and its ticked for export.

Looking into the war file I think I see the problem though, it has both 1.1 and 
1.3.2 of commons-io in the war so it could be a version clash...
Time to find and remove all the 1.1 instances.

Kindest regards


Theresa Forster
Senior Software Developer

-Original Message-
From: Michael Rubin [mailto:mru...@thunderhead.com] 
Sent: 06 June 2011 09:31
To: fop-users@xmlgraphics.apache.org
Subject: Re: Hair ripping time

Sounds like a possible classpath issue to me? Do you have commons-io-*.jar on 
your system? And if so, is it in your classpath? Does adding it to your 
classpath help?

Thanks to a google search, 
http://javacio.us/search?q=org%2Fapache%2Fcommons%2Fio%2Ffilefilter%2FIOFileFilter+more%3Ajar_filesinline=true
 appears to point out which jars contain the file and where they can be 
retrieved from if required, although I have not tested the links.

Thanks.

-Mike


On 06/06/11 09:25, Theresa Jayne Forster wrote:
 Thanks for that, it has improved my debugging but it seems to be implying an
 issue with FOP

 java.lang.NoSuchMethodError:
 org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter()Lorg/apache
 /commons/io/filefilter/IOFileFilter;
  at
 org.apache.fop.fonts.autodetect.FontFileFinder.getFileFilter(FontFileFinder.
 java:79)
  at
 org.apache.fop.fonts.autodetect.FontFileFinder.init(FontFileFinder.java:52
 )
  at org.apache.fop.fonts.FontDetector.detect(FontDetector.java:69)
  at
 org.apache.fop.fonts.FontInfoConfigurator.configure(FontInfoConfigurator.jav
 a:92)

 Kindest regards


 Theresa Forster
 Senior Software Developer

 



Michael Rubin
Developer

T: +44 20 8238 7400
F: +44 20 8238 7401

mru...@thunderhead.com

The contents of this e-mail are intended for the named addressee only. It 
contains information that may be confidential. Unless you are the named 
addressee or an authorized designee, you may not copy or use it, or disclose it 
to anyone else. If you received it in error please notify us 
immediately and then destroy it. 




-Original Message-
 From: Andreas L. Delmelle [mailto:andreas.delme...@telenet.be]
 Sent: 03 June 2011 21:54
 To: fop-users@xmlgraphics.apache.org
 Subject: Re: Hair ripping time

 On 03 Jun 2011, at 17:27, Theresa Jayne Forster wrote:

 Hi Theresa

 This makes no sense its crashing out with no error on this line
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 And it jumps straight to
   System.out.print(*);
 snip /
 }  catch (TransformerConfigurationException ex) {
 ex.printStackTrace();
 } catch (TransformerException ex) {
 ex.printStackTrace();
 } catch (FOPException ex) {
 ex.printStackTrace();
 } catch (FileNotFoundException ex) {
 ex.printStackTrace();
} catch (IOException ex) {
 ex.printStackTrace();
 } catch (Exception ex) {
 ex.printStackTrace();
 Not as a general practice, but if all else fails:

  } catch (Throwable t) {
  t.printStackTrace();
  }

 Hopefully, that will reveal what is happening here.


 Regards

 Andreas
 ---

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

 -
 No virus found in this message.
 Checked by AVG - www.avg.com
 Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
 Internal Virus Database is out of date.



 -
 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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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



RE: Hair ripping time

2011-06-06 Thread Theresa Jayne Forster
Ok Strange, I am running commons-io-1.4 now and its still not working but the 
fop I compiled up from source is using 1.3.1 so does that mean we are limited 
to 1.3.1 as there is missing functionality in the later versions?


Kindest regards


Theresa Forster
Senior Software Developer

ther...@inbrand.co.uk
www.inbrand.co.uk

Tel: 01483 266500



IMPORTANT NOTE: This transmission has been sent by or on behalf of In Brand 
Software Ltd. The information in this transmission is for the intended 
addressee only and is confidential to that intended addressee. If either you 
know or you ought reasonably to conclude that you are not, or may not be, the 
intended addressee, you are hereby given notice that any unauthorised 
dissemination or copying of this transmission and any disclosure or use of the 
information
transmitted is strictly prohibited and may be illegal. In such circumstances we 
ask for your assistance in notifying us immediately by e-mail, telephone or 
letter.

InBrand Software Ltd Registered in England No. 5131004 Registered Office: The 
Old Barn, Ewhurst Road, Cranleigh GU6 7EF 


-Original Message-
From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk] 
Sent: 06 June 2011 09:48
To: fop-users@xmlgraphics.apache.org
Subject: RE: Hair ripping time

I am running it under Apache Tomcat but I also have commons-io-1.3.2.jar in the 
Netbeans Libraries folder and its ticked for export.

Looking into the war file I think I see the problem though, it has both 1.1 and 
1.3.2 of commons-io in the war so it could be a version clash...
Time to find and remove all the 1.1 instances.

Kindest regards


Theresa Forster
Senior Software Developer

-Original Message-
From: Michael Rubin [mailto:mru...@thunderhead.com] 
Sent: 06 June 2011 09:31
To: fop-users@xmlgraphics.apache.org
Subject: Re: Hair ripping time

Sounds like a possible classpath issue to me? Do you have commons-io-*.jar on 
your system? And if so, is it in your classpath? Does adding it to your 
classpath help?

Thanks to a google search, 
http://javacio.us/search?q=org%2Fapache%2Fcommons%2Fio%2Ffilefilter%2FIOFileFilter+more%3Ajar_filesinline=true
 appears to point out which jars contain the file and where they can be 
retrieved from if required, although I have not tested the links.

Thanks.

-Mike


On 06/06/11 09:25, Theresa Jayne Forster wrote:
 Thanks for that, it has improved my debugging but it seems to be implying an
 issue with FOP

 java.lang.NoSuchMethodError:
 org.apache.commons.io.filefilter.FileFilterUtils.fileFileFilter()Lorg/apache
 /commons/io/filefilter/IOFileFilter;
  at
 org.apache.fop.fonts.autodetect.FontFileFinder.getFileFilter(FontFileFinder.
 java:79)
  at
 org.apache.fop.fonts.autodetect.FontFileFinder.init(FontFileFinder.java:52
 )
  at org.apache.fop.fonts.FontDetector.detect(FontDetector.java:69)
  at
 org.apache.fop.fonts.FontInfoConfigurator.configure(FontInfoConfigurator.jav
 a:92)

 Kindest regards


 Theresa Forster
 Senior Software Developer

 



Michael Rubin
Developer

T: +44 20 8238 7400
F: +44 20 8238 7401

mru...@thunderhead.com

The contents of this e-mail are intended for the named addressee only. It 
contains information that may be confidential. Unless you are the named 
addressee or an authorized designee, you may not copy or use it, or disclose it 
to anyone else. If you received it in error please notify us 
immediately and then destroy it. 




-Original Message-
 From: Andreas L. Delmelle [mailto:andreas.delme...@telenet.be]
 Sent: 03 June 2011 21:54
 To: fop-users@xmlgraphics.apache.org
 Subject: Re: Hair ripping time

 On 03 Jun 2011, at 17:27, Theresa Jayne Forster wrote:

 Hi Theresa

 This makes no sense its crashing out with no error on this line
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 And it jumps straight to
   System.out.print(*);
 snip /
 }  catch (TransformerConfigurationException ex) {
 ex.printStackTrace();
 } catch (TransformerException ex) {
 ex.printStackTrace();
 } catch (FOPException ex) {
 ex.printStackTrace();
 } catch (FileNotFoundException ex) {
 ex.printStackTrace();
} catch (IOException ex) {
 ex.printStackTrace();
 } catch (Exception ex) {
 ex.printStackTrace();
 Not as a general practice, but if all else fails:

  } catch (Throwable t) {
  t.printStackTrace();
  }

 Hopefully, that will reveal what is happening here.


 Regards

 Andreas
 ---

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

 -
 No virus found in this message.
 Checked by AVG - www.avg.com
 Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
 Internal Virus Database is out of date

RE: Hair ripping time

2011-06-06 Thread Theresa Jayne Forster
Ok, solution found, and I think this needs to be noted down,

Using Netbeans, added Frameworks

Spring Web MVC
JavaServer Faces
Struts 1.3.8
Hibernate 3.2.5

The problem is the struts, it comes with commons-io-1.1.jar and doesn’t have 
one of the methods in the font autodetect code that was implemented in 1.3.1 
and up.
So I had to go into the library defs in the struts framework and delete the 1.1 
and replace it with the 1.3.1 and it now works fine.


Kindest regards


Theresa Forster
Senior Software Developer

-Original Message-
From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk] 
Sent: 06 June 2011 10:54
To: fop-users@xmlgraphics.apache.org
Subject: RE: Hair ripping time

Sorry to keep posting but its strange and I am trying to understand, when I 
find something new I am also letting you know so old ground isn’t covered 
again. 

1) Runs stand alone fine, 
2) War file contains the commons-io file
3) Running under Tomcat 6 it fails with a Method not found error.
4) could it be due to Tomcat 6 having a different default commons-io in its 
build somewhere? And if so , where so I can upgrade it?


Kindest regards


Theresa Forster
Senior Software Developer

-Original Message-
From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk] 
Sent: 06 June 2011 10:23
To: fop-users@xmlgraphics.apache.org
Subject: RE: Hair ripping time

Ok Strange, I am running commons-io-1.4 now and its still not working but the 
fop I compiled up from source is using 1.3.1 so does that mean we are limited 
to 1.3.1 as there is missing functionality in the later versions?


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



-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1382 / Virus Database: 1511/3683 - Release Date: 06/05/11


-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1382 / Virus Database: 1511/3683 - Release Date: 06/05/11



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



Re: Hair ripping time

2011-06-03 Thread John Burgess
The xslt is used to transform from your source format to the FO format used by FOP.  If you already 
have a formatting object file, you can pass it to fop immediately without transformation.


xsl can be a bit tricky to get started on, some like O'reilly's Java and XSLT book is probably a 
good place to start.


FOP itself seems to produce reasonable messages.

--
John Burgess
Risk Decisions Limited
Whichford House
Parkway Court
Oxford Business Park South
OX4 2JY

T: 01865 718666
F: 01865 718600
M: 07984 863890
E: john.burg...@riskdecisions.com
W: http://www.riskdecisions.com



On 03/06/2011 15:30, Theresa Jayne Forster wrote:


Ok I cannot see what is wrong here,

A test app does this

Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

TransformerFactory factory = TransformerFactory.newInstance();

Source xslt = new StreamSource(new File(C:/sample.xsl));

Transformer transformer = factory.newTransformer(xslt);

And works fine,

The app I am working on does this

Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

TransformerFactory factory = TransformerFactory.newInstance();

Transformer transformer = factory.newTransformer(new 
StreamSource(inputFO));

And it immediately jumps out when it hits the newTransformer() line

In the first it's an xslt, in the second it's a FO file, do I have to do 
something different for that?

WTF aren't these the same, and why does so much of FOP jump out without even trying to give debug 
output? Or is there a way of doing that?


Kindest regards


Theresa Forster

Senior Software Developer



Re: Hair ripping time

2011-06-03 Thread Andreas L. Delmelle
On 03 Jun 2011, at 16:30, Theresa Jayne Forster wrote:

Hi Theresa

 Ok I cannot see what is wrong here,`
snip /
 The app I am working on does this
  
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 TransformerFactory factory = TransformerFactory.newInstance();
 Transformer transformer = factory.newTransformer(new 
 StreamSource(inputFO));
  
 And it immediately jumps out when it hits the newTransformer() line….

... because a FO file is not a valid stylesheet. 

Seems like you need:

Transformer transformer = factory.newTransformer();
transformer.transform(new StreamSource(inputFO));


HTH!

Regards

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



RE: Hair ripping time

2011-06-03 Thread Theresa Jayne Forster
Tried that same result, it jumps immediately out of the try catch into the
finally

Kindest regards


Theresa Forster
Senior Software Developer

Seems like you need:

Transformer transformer = factory.newTransformer();
transformer.transform(new StreamSource(inputFO));


HTH!

Regards

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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



RE: Hair ripping time

2011-06-03 Thread Eric Douglas
1. You can and should reuse the TransformerFactory.
2. FO is not a stylesheet.  The FO is the input to the transform, where
you were putting the XML not the XSL.  Leave out the XSL part on the FO
one.
 



From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk] 
Sent: Friday, June 03, 2011 10:30 AM
To: fop-users@xmlgraphics.apache.org
Subject: Hair ripping time



Ok I cannot see what is wrong here, 

A test app does this 

 

Fop fop =
fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

TransformerFactory factory =
TransformerFactory.newInstance();

Source xslt = new StreamSource(new File(C:/sample.xsl));

Transformer transformer = factory.newTransformer(xslt);

 

And works fine, 

The app I am working on does this

 

Fop fop =
fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

TransformerFactory factory =
TransformerFactory.newInstance();

Transformer transformer = factory.newTransformer(new
StreamSource(inputFO));

 

And it immediately jumps out when it hits the newTransformer() line

In the first it's an xslt, in the second it's a FO file, do I have to do
something different for that?

 

WTF aren't these the same, and why does so much of FOP jump out without
even trying to give debug output? Or is there a way of doing that?

 

 

Kindest regards

 


Theresa Forster

Senior Software Developer



 



RE: Hair ripping time

2011-06-03 Thread Theresa Jayne Forster
This makes no sense its crashing out with no error on this line
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
And it jumps straight to 
  System.out.print(*);

The code I am using is as follows

public File generatePDFFromXml(File xslFile,File xmlFile) {
FopFactory fopFactory = FopFactory.newInstance();
BufferedOutputStream out = null;
File tempFile = null;
try {
fopFactory.setStrictValidation(false);
DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();
Configuration cfg = cfgBuilder.buildFromFile(new
File(fopconfig.xml));
fopFactory.setUserConfig(cfg);

tempFile = File.createTempFile(W2P, .pdf);
out = new BufferedOutputStream(new FileOutputStream(tempFile));
FOUserAgent useragent= fopFactory.newFOUserAgent();
useragent.setOutputFile(tempFile);
useragent.setTargetResolution(300);
Fop fop =
fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
TransformerFactory factory = TransformerFactory.newInstance();
Source xslt = new StreamSource(xslFile);
Transformer transformer = factory.newTransformer(xslt);
Source src = new StreamSource(xmlFile);
Result res = new SAXResult(fop.getDefaultHandler());
transformer.transform(src, res);
   out.flush();
   out.close();
System.out.println(Output File = +tempFile.getAbsolutePath());
}  catch (TransformerConfigurationException ex) {
ex.printStackTrace();
} catch (TransformerException ex) {
ex.printStackTrace();
} catch (FOPException ex) {
ex.printStackTrace();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
   } catch (IOException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
  System.out.print(*);
out.close();
   } catch (IOException ex) {
}
}
return tempFile;
}

Kindest regards


Theresa Forster
Senior Software Developer

ther...@inbrand.co.uk
www.inbrand.co.uk

Tel: 01483 266500



IMPORTANT NOTE: This transmission has been sent by or on behalf of In Brand
Software Ltd. The information in this transmission is for the intended
addressee only and is confidential to that intended addressee. If either you
know or you ought reasonably to conclude that you are not, or may not be,
the intended addressee, you are hereby given notice that any unauthorised
dissemination or copying of this transmission and any disclosure or use of
the information
transmitted is strictly prohibited and may be illegal. In such circumstances
we ask for your assistance in notifying us immediately by e-mail, telephone
or letter.

InBrand Software Ltd Registered in England No. 5131004 Registered Office:
The Old Barn, Ewhurst Road, Cranleigh GU6 7EF 


-Original Message-
From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk] 
Sent: 03 June 2011 15:42
To: fop-users@xmlgraphics.apache.org
Subject: RE: Hair ripping time

Tried that same result, it jumps immediately out of the try catch into the
finally

Kindest regards


Theresa Forster
Senior Software Developer

Seems like you need:

Transformer transformer = factory.newTransformer();
transformer.transform(new StreamSource(inputFO));


HTH!

Regards

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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



Re: Hair ripping time

2011-06-03 Thread Glenn Adams
XSLT != XSL-FO

Completely different languages.

G.

On Fri, Jun 3, 2011 at 8:30 AM, Theresa Jayne Forster ther...@inbrand.co.uk
 wrote:

 Ok I cannot see what is wrong here,

 A test app does this



 Fop fop =
 fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

 TransformerFactory factory = TransformerFactory.newInstance();

 Source xslt = new StreamSource(new File(C:/sample.xsl));

 Transformer transformer = factory.newTransformer(xslt);



 And works fine,

 The app I am working on does this



 Fop fop =
 fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);

 TransformerFactory factory = TransformerFactory.newInstance();

 Transformer transformer = factory.newTransformer(new
 StreamSource(inputFO));



 And it immediately jumps out when it hits the newTransformer() line….

 In the first it’s an xslt, in the second it’s a FO file, do I have to do
 something different for that?



 WTF aren’t these the same, and why does so much of FOP jump out without
 even trying to give debug output? Or is there a way of doing that?





 Kindest regards




 Theresa Forster

 Senior Software Developer





RE: Hair ripping time

2011-06-03 Thread Theresa Jayne Forster
Sorry I think we have moved on from that – I was testing it in a slightly 
different way as the example method wasn’t working, 

 

The problem is when I do the newFop command its exiting from the system 
completely, the standalone app works fine with the same config etc.

 

The spring app under tomcat is doing the following in the logs

 

2011-06-03 16:54:44,292 [http-8080-2] INFO  uk.co.inbrand.inline.InLine - 
Processing Incoming Request..

2011-06-03 16:54:49,150 [http-8080-2] DEBUG 
org.apache.fop.apps.FopFactoryConfigurator - Initializing FopFactory 
Configurationwith strict validation

2011-06-03 16:54:49,151 [http-8080-2] DEBUG FOP - target-resolution set to: 
300.0dpi (px2mm=0.0846)

2011-06-03 16:54:49,151 [http-8080-2] DEBUG FOP - target-resolution set to: 
300.0dpi (px2mm=0.0846)

2011-06-03 16:54:49,152 [http-8080-2] DEBUG 
org.apache.fop.render.AbstractConfigurator - User configuration found for MIME 
type application/pdf

2011-06-03 16:54:49,152 [http-8080-2] DEBUG 
org.apache.fop.render.AbstractConfigurator - User configuration found for MIME 
type application/pdf

2011-06-03 16:54:49,152 [http-8080-2] DEBUG 
org.apache.fop.fonts.FontInfoConfigurator - Starting font configuration...

 

Kindest regards

 


Theresa Forster

Senior Software Developer





Re: Hair ripping time

2011-06-03 Thread Rob Sargent

That print statement will always be called since it's in the finally block.

On 06/03/2011 09:27 AM, Theresa Jayne Forster wrote:

This makes no sense its crashing out with no error on this line
Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
And it jumps straight to
   System.out.print(*);

The code I am using is as follows

public File generatePDFFromXml(File xslFile,File xmlFile) {
 FopFactory fopFactory = FopFactory.newInstance();
 BufferedOutputStream out = null;
 File tempFile = null;
 try {
 fopFactory.setStrictValidation(false);
 DefaultConfigurationBuilder cfgBuilder = new
DefaultConfigurationBuilder();
 Configuration cfg = cfgBuilder.buildFromFile(new
File(fopconfig.xml));
 fopFactory.setUserConfig(cfg);

 tempFile = File.createTempFile(W2P, .pdf);
 out = new BufferedOutputStream(new FileOutputStream(tempFile));
 FOUserAgent useragent= fopFactory.newFOUserAgent();
 useragent.setOutputFile(tempFile);
 useragent.setTargetResolution(300);
 Fop fop =
fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 TransformerFactory factory = TransformerFactory.newInstance();
 Source xslt = new StreamSource(xslFile);
 Transformer transformer = factory.newTransformer(xslt);
 Source src = new StreamSource(xmlFile);
 Result res = new SAXResult(fop.getDefaultHandler());
 transformer.transform(src, res);
out.flush();
out.close();
 System.out.println(Output File = +tempFile.getAbsolutePath());
 }  catch (TransformerConfigurationException ex) {
 ex.printStackTrace();
 } catch (TransformerException ex) {
 ex.printStackTrace();
 } catch (FOPException ex) {
 ex.printStackTrace();
 } catch (FileNotFoundException ex) {
 ex.printStackTrace();
} catch (IOException ex) {
 ex.printStackTrace();
 } catch (Exception ex) {
 ex.printStackTrace();
 } finally {
 try {
   System.out.print(*);
 out.close();
} catch (IOException ex) {
 }
 }
 return tempFile;
 }

Kindest regards


Theresa Forster
Senior Software Developer

ther...@inbrand.co.uk
www.inbrand.co.uk

Tel: 01483 266500



IMPORTANT NOTE: This transmission has been sent by or on behalf of In Brand
Software Ltd. The information in this transmission is for the intended
addressee only and is confidential to that intended addressee. If either you
know or you ought reasonably to conclude that you are not, or may not be,
the intended addressee, you are hereby given notice that any unauthorised
dissemination or copying of this transmission and any disclosure or use of
the information
transmitted is strictly prohibited and may be illegal. In such circumstances
we ask for your assistance in notifying us immediately by e-mail, telephone
or letter.

InBrand Software Ltd Registered in England No. 5131004 Registered Office:
The Old Barn, Ewhurst Road, Cranleigh GU6 7EF


-Original Message-
From: Theresa Jayne Forster [mailto:ther...@inbrand.co.uk]
Sent: 03 June 2011 15:42
To: fop-users@xmlgraphics.apache.org
Subject: RE: Hair ripping time

Tried that same result, it jumps immediately out of the try catch into the
finally

Kindest regards


Theresa Forster
Senior Software Developer

Seems like you need:

Transformer transformer = factory.newTransformer();
transformer.transform(new StreamSource(inputFO));


HTH!

Regards

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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



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

-
No virus found in this message.
Checked by AVG - www.avg.com
Version: 10.0.1375 / Virus Database: 1509/3662 - Release Date: 05/26/11
Internal Virus Database is out of date.



-
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: Hair ripping time

2011-06-03 Thread Andreas L. Delmelle
On 03 Jun 2011, at 17:27, Theresa Jayne Forster wrote:

Hi Theresa

 This makes no sense its crashing out with no error on this line
 Fop fop = fopFactory.newFop(MimeConstants.MIME_PDF,useragent,out);
 And it jumps straight to 
  System.out.print(*);
snip /
}  catch (TransformerConfigurationException ex) {
ex.printStackTrace();
} catch (TransformerException ex) {
ex.printStackTrace();
} catch (FOPException ex) {
ex.printStackTrace();
} catch (FileNotFoundException ex) {
ex.printStackTrace();
   } catch (IOException ex) {
ex.printStackTrace();
} catch (Exception ex) {
ex.printStackTrace();

Not as a general practice, but if all else fails:

} catch (Throwable t) {
t.printStackTrace();
}

Hopefully, that will reveal what is happening here.


Regards

Andreas
---

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