[NFOP] Insertion d'images .png

vendeeman85 Messages postés 6 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 28 février 2007 - 30 août 2006 à 17:56
cs_ggiry Messages postés 1 Date d'inscription vendredi 19 mars 2004 Statut Membre Dernière intervention 23 novembre 2006 - 23 nov. 2006 à 10:29
Bonjour à tous,

voila je souhaite créer des PDF via NFOP. Cela fonctionne très bien sauf pour les images.
Pour info voici le code pour utiliser la librairie Apachefop.NET.dll

/*****************************************/
using ApacheFop;
...
//test.fo fichier d'entrée
//test.pdf, fichier de sortie

Transform(test.fo, test.pdf);

static

protected
void Transform(
string xmldocFo,
string strFilename){

// Run the full FO doc through the engine to create a pdf

Engine e =
new
Engine();

sbyte[] sPdf = e.Run(xmldocFo);

int sz = sPdf.Length;

byte[] pdf =
new
byte[sz];

for (int i 0; i < sz; i++)pdf[i] (

byte)sPdf[i];

//Write output file

FileStream fs =
new
FileStream(strFilename,
FileMode.Create);

BinaryWriter sw =
new
BinaryWriter(fs);sw.Write(pdf);

sw.Close();

fs.Close();

}

/****************************************/

Mon probleme étant que dans le fichier test.fo j'insere une image .png de la manière suivante:

<fo:block-container position="absolute" border-style="solid" border-color="#FFFFFF" border-width="0.2pt" top="200.0pt" left="50.0pt" height="450.0pt" width="370.0pt">

<fo:block>

<fo:external-graphic src="url(../../../res_ter1/batik/outputimage/atlas1_batik_CS1_nuancier_moyenne.png)" height="433pt" width="353pt"/>

</fo:block>

</fo:block-container>

Cela fonctionne très bien quand j'utilise, pour tests, le Fop.bat (dc java) mais je me demande si en C# la fonctionnalité image est prévue. Et si oui, dans ce cas pourquoi cela ne fonctionne pas.

Merci d'avance,

VDM

1 réponse

cs_ggiry Messages postés 1 Date d'inscription vendredi 19 mars 2004 Statut Membre Dernière intervention 23 novembre 2006
23 nov. 2006 à 10:29
Bonjour,

En faisiant le test, je me suis aperçu qu'en mettant le chemin complet c:/.../.., cela fonctionnait.

A mon avis, le d"ébut du chemin relatif est différent sou C# et sous java

Cordialement

Ghislain
0
Rejoignez-nous