• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

PDF creation using iTEXT

 
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends..
I am using iTEXT to convert xhtml into pdf in a web application.i am getting the following error.I tried my level best to spot the cause of the error.But could not do it.

The Code:


String inputFile = "D://Data_Local//xml//docs//testXHTML.xml";
String url = new File(inputFile).toURI().toURL().toString();
String outputFile = "D://Data_Local//xml//docs//firstdoc.pdf";
OutputStream os = new FileOutputStream(outputFile);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
renderer.layout();
renderer.createPDF(os);
os.close();


Error:

Exception occured While Logging In : org.xhtmlrenderer.util.XRRuntimeException: Failed on configuring SAX to DOM transformer.


This same java code works fine when it is used in java application but throws this exception when used in web application....


Thank You.....


 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So you're actually using the FlyingSaucer library, not iText.

Are you certain that this: "new File(inputFile).toURI().toURL().toString()" produces something sensible?
 
Daniel Sagayaraj
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Ulf Dittmer wrote:So you're actually using the FlyingSaucer library, not iText.

Are you certain that this: "new File(inputFile).toURI().toURL().toString()" produces something sensible?




ya checked that dear...

it returns--->file:/D:/Data_Local/xml/docs/testXHTML.xml

 
Daniel Sagayaraj
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Yamuna Daniel wrote:Dear Friends..
I am using iTEXT to convert xhtml into pdf in a web application.i am getting the following error.I tried my level best to spot the cause of the error.But could not do it.

The Code:


String inputFile = "D://Data_Local//xml//docs//testXHTML.xml";
String url = new File(inputFile).toURI().toURL().toString();
String outputFile = "D://Data_Local//xml//docs//firstdoc.pdf";
OutputStream os = new FileOutputStream(outputFile);
ITextRenderer renderer = new ITextRenderer();
renderer.setDocument(url);
renderer.layout();
renderer.createPDF(os);
os.close();


Error:

Exception occured While Logging In : org.xhtmlrenderer.util.XRRuntimeException: Failed on configuring SAX to DOM transformer.


This same java code works fine when it is used in java application but throws this exception when used in web application....


Thank You.....




Dear Friends...

The same code works fine with both java application and web application.The problem is...
it doesn't work in one particular project...



 
Daniel Sagayaraj
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Friends...
I was not able to fine the cause of the error but found the alternative to the achieve the requirement..

It works when i pass org.w3c.dom.Document instead of passing a file URL ....
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic