Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

Sujet : GENERATION DE PDF A PARTIR DE XML [ Archives / Au secours ] (AS_DE_TREFLE)

dimanche 5 septembre 2004 à 06:40:51 | GENERATION DE PDF A PARTIR DE XML

AS_DE_TREFLE

JE VEUX GENERER DU PDF A PARTIR DU XML. EN EFFET J'OBTIENS A PARTIR D'UNE SERVLET LE FICHIER XML SVT:

<?XML >

<LISTE-CLIENTS>

<CLIENT>
<RAISON-SOCIALE> ETS1</RAISON-SOCIALE>
<ADRESSE-CLIENT>AD1</ADRESSE-CLIENT>
</CLIENT>

<CLIENT>
<RAISON-SOCIALE> ETS2</RAISON-SOCIALE>
<ADRESSE-CLIENT>AD2</ADRESSE-CLIENT>
</CLIENT>

<CLIENT>
<RAISON-SOCIALE> ETS3</RAISON-SOCIALE>
<ADRESSE-CLIENT>AD3</ADRESSE-CLIENT>
</CLIENT>

................

..................

</LISTE-CLIENTS>

MON PB EST LE SUIVANT COMMENT ECREIRE LE FICHIER XSL ASSOCIER.

SVP J'AI BESOIN D'UNE REPONSE LE PLUS VITE POSSIBLE. JE SUIS DANS UNE URGENCE.
MERCI DE POUVOIR COMPTER SUR VOUS.

dimanche 5 septembre 2004 à 10:45:27 | Re : GENERATION DE PDF A PARTIR DE XML

gmi19oj19

Membre Club
Meci de ne pas crier, on est pas sourds.
D'autre part, ça ne sert à rien de recréer un sujet déjà existant.

gmi19oj19

lundi 6 septembre 2004 à 22:55:20 | Re : GENERATION DE PDF A PARTIR DE XML

CoreBreaker

J'ai utilisé FOP 0.20.3

Voici le fichier de données que j'ai utilisé pour tester le XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>

<LISTE-CLIENTS>
<CLIENTS>
<RAISON-SOCIALE> ETS 1 </RAISON-SOCIALE>
<ADRESSE-CLIENT> AD1 </ADRESSE-CLIENT>
</CLIENTS>

<CLIENTS>
<RAISON-SOCIALE> ETS 2 </RAISON-SOCIALE>
<ADRESSE-CLIENT> AD2 </ADRESSE-CLIENT>
</CLIENTS>

<CLIENTS>
<RAISON-SOCIALE> ETS 3 </RAISON-SOCIALE>
<ADRESSE-CLIENT> AD3 </ADRESSE-CLIENT>
</CLIENTS>
</LISTE-CLIENTS>


Voici maintenant le XSL:
<?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
xmlns:fo="http://www.w3.org/1999/XSL/Format">

<xsl:output method="xml" indent="yes" encoding="ISO-8859-1" />

<xsl:template match="/LISTE-CLIENTS">
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master
master-name="first"
page-height="21cm"
page-width="29.7cm"
margin-top="0.5cm"
margin-bottom="0.5cm"
margin-left="0.5cm"
margin-right="0.5cm">
<fo:region-body margin-top="0.5cm" />
<fo:region-before extent="1cm" />
<fo:region-after extent="0.5cm" />
</fo:simple-page-master>
</fo:layout-master-set>

<fo:page-sequence master-reference="first">
<fo:static-content flow-name="xsl-region-after">
<fo:block text-align-last="end" font-size="10pt">Page <fo:page-number /></fo:block>
</fo:static-content>

<fo:flow flow-name="xsl-region-body">
<fo:table table-omit-footer-at-break="true">
<fo:table-column column-width="10cm" />
<fo:table-column column-width="10cm" />
<fo:table-header>
<fo:table-row background-color="silver">
<fo:table-cell border-width="2pt" border-before-style="solid" border-start-style="solid" border-after-style="solid">
<fo:block font-size="9pt" text-align="center" space-before.optimum="22pt" space-after.optimum="22pt">
Raison sociale
</fo:block>
</fo:table-cell>

<fo:table-cell border-width="2pt" border-style="solid">
<fo:block font-size="9pt" text-align="center" space-before.optimum="22pt" space-after.optimum="22pt">
Adresse client
</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
<fo:table-body>
<xsl:apply-templates select="CLIENTS" />
</fo:table-body>
</fo:table>
</fo:flow>
</fo:page-sequence>
</fo:root>
</xsl:template>

<xsl:template match="/LISTE-CLIENTS/CLIENTS">
<fo:table-row keep-together="always">
<fo:table-cell border-width="2pt" border-start-style="solid" border-after-style="solid">
<fo:block font-size="8pt" text-align="center" space-before.optimum="10pt">
<xsl:value-of select="RAISON-SOCIALE" />
</fo:block>
</fo:table-cell>

<fo:table-cell border-width="2pt" border-start-style="solid" border-after-style="solid" border-end-style="solid">
<fo:block font-size="8pt" text-align="center" space-before.optimum="10pt" space-after.optimum="10pt">
<xsl:value-of select="ADRESSE-CLIENT" />
</fo:block>
</fo:table-cell>
</fo:table-row>\n";
</xsl:template>

</xsl:stylesheet>


Core Breaker



Cette discussion est classé dans : fichier, partir, xml, pdf, generation


Répondre à ce message

Sujets en rapport avec ce message

GENERATION DE PDF A PARTIR DE XML [ par AS_DE_TREFLE ] je voudrais generer du PDF à partir d'un fichier XML qui lui reprend toutes les enregistrements d'une table. Comment devrais procedre.Un exemple sera GENERATION DE PDF A PARTIR DE XML [ par AS_DE_TREFLE ] J'ai effectivement reçu votre mail et je vous remercie de la promptitude avec laquelle vous m'avez repondu. le seul hic est ke qd je lance ma servlet appeler un fichier pdf à partir d'une page jsp [ par wadiaa2 ] bnojour, svp, comment appeler un fichier pdf à partir d'une page jsp? c est urgent svp mercisophya A partir fichier XML => graphe [ par javaKatz ] Dans le cadre d'un projet d'E-learning, j'ai des petits soucis pour bien concevoir quels outils utiliser. Un élève va voir son cours en ligne, nous ré JSP vers PDF [ par cedzed ] Bonjour,Je ne suis qu'au stade d'analyse et je voudrai savoir tout d'abord s'il est possible d'avoir un format PDF d'une page affichée en JSP?J'ai vu créer un fichier excel à partir d'un fichier xml [ par Tara ] Bonjour à tous !Mon problème se résume dans le sujet à savoir : comment puis-je créer un fichier excel à partir d'un fichier xml ?Faut-il que je passe xml + fop -> pdf [ par dmothes ] ben j'ai essayé la source pour créer un fichier pdf à partir d'un fichier xml et d'un xsl-fohttp://www.javafr.com/code.aspx?ID=15611mais j'obtien tjs charger des parmètres de configuration à partir d'un fichier XML [ par mnasri_riadh ] Salut,Je voudrais utiliser des paramètres de configuration à partir d'un fichier XML (lecture de noeuds et d'attributs).C'est à dire, je voudrais char Créer un fichier Xml à partir d'un fichier indiquant la structure [ par brice_nice ] Bonjour,Je voudrais savoir si il existe un moyen pour lire un fichier de structure, et de créer un fichier Xml à partir de ce fichier, en récupérant l création d'un fichier XML à partir d'un DTD [ par hamdinoura2005 ] je dois créer un fichier XML à partir d'un DTD, je sais pas comment le faire !Y a-t-il un parseur pour DTD ?


Nos sponsors

Sondage...

CalendriCode

Décembre 2008
LMMJVSD
1234567
891011121314
15161718192021
22232425262728
293031    

Consulter la suite du CalendriCode

Téléchargements

Logiciels à télécharger sur le même thème :



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,156 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.