Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

PDF Creation Using Given XML and XSL

 
naval kumar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i Generate PDF Using XML and XSL ?.please give me reply
 
Mi Jo
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use Apache FOP. See if it works for you.
 
naval kumar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sir , i have to use basic java programming means Inside of

public static void main(String s[])
{
}
and from a particular path i want to use Generated XML and XSl and generate the PDF not use of Apache. Only Use of Itext latest version.
Actully i have created the PDF Of using Itext 1.0 version but when i go to itext heigher version the PDF Formatting is Not in proper formatted.so please please suggest me How can i create PDF Using XML and XSL OF ITEXT latest Version
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We use iText. Pretty powerful, and we generate some really nice pdfs.

As for your question, if you have the XML and XSL transformers, it should be straightforward.

There is no easy path, and no one can tell you exactly how to do it.

WP
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
naval kumar wrote:not use of Apache. Only Use of Itext latest version. Actully i have created the PDF Of using Itext 1.0 version but when i go to itext heigher version the PDF Formatting is Not in proper formatted.so please please suggest me How can i create PDF Using XML and XSL OF ITEXT latest Version

Not wanting to use FOP does not make sense. It's perfect for creating PDFs when you have regular data in XML format. What's the rationale that makes iText OK, but not FOP? (Note that FOP uses iText for PDF generation.)

And since you mention iText's latest version (5.something), note that it requires you to obtain a license and pay money for just about any commercial scenario.
 
naval kumar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please Sir provide me or given Me a link where i can find the code using Itext to generate PDF using XML and XSl which is in my C:\\ drive.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are no easy answers or simple links to full solutions. You will actually have to learn how to do this.

Since you mention XSL, are you now saying that using FOP is OK? If so, the Apache FOP site has lots of documentation to get you started. Or what role do you envision XSL to play in this?
 
naval kumar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, i do not want to use APACHE FOP I want to USE itext.jar. please help me out using ITEXT.JAR to Create PDF By XSL and XML.
My XSL is like
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="report/persondetail">
<table width="100%" border="1" height="2%" cellpadding="2">

<tr>
<td> <xsl:value-of select="name"/> </td>
<td> <xsl:value-of select="surname"/> </td>
</tr>
</table>
</xsl:for-each>

</body>
</html>
</xsl:template>
</xsl:stylesheet>

and XMl is like
<?xml version="1.0" encoding="iso-8859-1"?>
<report>
<persondetail>
<name>Vishal Singh</name>
<surname>9990806</surname>
</persondetail>
<persondetail>
<name>Naval Gupta</name>
<surname>99061230</surname>
</persondetail>
</report>
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The XSL creates HTML; what is its connection to creating PDF?

You still haven't said why you don't want to use FOP; it's perfect for creating PDFs from XML data, especially if you know XSL.
 
naval kumar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually sir After Creating the PDF i Have to use Digitally signed and water mark on to the PDF . and some one told me for this you have to use only itext.jar.
if sir i can do by APACHE FOP,please provide me link how can i create,sign,watermark on the pdf. thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Watermarking a PDF and signing a PDF are both independent of creating a PDF. You can certainly use other tools than iText for those tasks, including FOP itself for watermarking. For signing you can use PDFBox in conjunction with BouncyCastle; search for those terms and you'll find pointers to an explanation of how that works.

Or you can use iText just for signing; using it for creating the PDF may be more complicated than using FOP, though. Depends on how regular or irregular you PDFs are, and how good your knowledge of XSL is (which you'd need to use FOP).

Examples of how to use FOP to create PDFs come with FOP, and can be found on the FOP web site.
 
naval kumar
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Sir Please Help me :- I have lot of Search But Not found the Code According To My Question
I have One XML :=
<?xml version="1.0"?>
<report>
<persondetail>
<name>Vishal Singh</name>
<surname>9990806510</surname>
</persondetail>

<persondetail>
<name>Vishal Singh</name>
<surname>9990806510</surname>
</persondetail>

</report>

and One XSl====>

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
<xsl:for-each select="report/persondetail">
<table width="100%" border="1" height="2%" cellpadding="2">
<tr>
<td width="10%"> <xsl:value-of select="name"/> </td>
<td width="90%"> <xsl:value-of select="surname"/> </td>
</tr>

</table>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>

I want to Create PDF Using The XML and XSl from A Specific Location And Signing, WaterMark Of PDF also.

Please Provide me Code. I will be very Thankful to you
Thanks
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you decided on how to approach this? If you want to use FOP, then you must have read the documentation on the FOP site by now, and tried to run the examples that come with FOP...? If you have decided to do it some other way, let us know what that way is.

As I said before, there is no simple shortcut besides learning how to do it, and -especially- nobody here is going to to do it for you and then post the code here. If that's what you're looking for, hire a contractor.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic