IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

API standards et tierces Java Discussion :

Intégration d'arabe dans un fichier PDF


Sujet :

API standards et tierces Java

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    350
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 350
    Par défaut Intégration d'arabe dans un fichier PDF
    Bonjour tout le monde,

    J'utilise netBeans 6.9.1, je génère des PDF, je veux afficher des texte en arabe dans ce PDF.

    j'ai fait pas mal de recherches sur le net, j'ai suivi ce lien :
    http://www.developpez.net/forums/d47...rties-utf-8-a/.

    Mais ça marche pas.

    Avez-vous SVP des indications ou exemples pour ça?.

    Merci d'avance.

  2. #2
    Modérateur

    Profil pro
    Inscrit en
    Septembre 2004
    Messages
    12 582
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Septembre 2004
    Messages : 12 582
    Par défaut
    Personne ne va deviner comment tu génères tes pdf.
    N'oubliez pas de consulter les FAQ Java et les cours et tutoriels Java

  3. #3
    Membre éclairé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    350
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 350
    Par défaut
    Merci pour votre réponse.
    Je génère mon PDF en utilisant Itext.
    Voici mon code :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    public static void main(String[] args) throws FileNotFoundException {
       Document document = new Document(PageSize.A4);
     
     
    		try{
    			PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(RESULT));
     
     
     
     
    //			Ajout de l'entête gauche
    			Paragraph para1 = new Paragraph();
    			para1.add("Entete du fichier PDF");
    			HeaderFooter header = new HeaderFooter(para1,false);
     
    			header.setAlignment(HeaderFooter.ALIGN_LEFT);
                            document.setHeader(header);
     
     
     
    //			Ajout du pied de page
    			Paragraph para2 = new Paragraph();
    			para2.add("Pied de page");
    			HeaderFooter footer = new HeaderFooter(para2,false);
    			footer.setAlignment(HeaderFooter.ALIGN_CENTER);
    			document.setFooter(footer);
     
                            writer.close();
                            document.open();
                            document.newPage();
     
                            /*************************************************/
                            /*************************************************/
                            PdfPTable tableHaut = new PdfPTable(1);
                            PdfPCell cellHaut = new PdfPCell(new Paragraph("Docteur flan wled frtllan"));
                            cellHaut.setHorizontalAlignment(Cell.ALIGN_LEFT);
                            tableHaut.addCell(cellHaut);
                            document.add(tableHaut);
                            /*************************************************/
                            /**************************************************/
    			//Image img = Image.getInstance("Workspace/win/WebContent/images/zoomold.jpg");
    			//img.scalePercent(100);
    			Phrase h1 = new Phrase("header 1");
    			Phrase h2 = new Phrase("header 2");
    			//HeaderFooter header = new HeaderFooter(h1,h2);
    			//document.setHeader(header);
    			Phrase f1 = new Phrase("footer 1");
    			Phrase f2 = new Phrase("footer 2");
    			//HeaderFooter footer = new HeaderFooter(f1,f2);
    			//document.setFooter(footer);
    			//document.add(header);
    			//document.add(footer);
                            int numTransaction = 1560;
                            String titreEdTransaction = "l3onwan dyam transaction";
                            String numVoie = "30021";
                            String typeVoie ="9002";
                            String nomVoie = "Zen9at lbo3ara";
                            String codePostal = "20600";
                            String commune = "Bernoussi";
                            String prenomNego = "Rachid";
                            String nomNego = "AMINE";
    			Font fontRed = FontFactory.getFont(FontFactory.COURIER, 8, Font.NORMAL, new Color(255,0,0));
    			Font fontTitre =  new Font(Font.HELVETICA,Font.DEFAULTSIZE,Font.BOLD);
    			Font fontLibelle =  new Font(Font.HELVETICA,8,Font.NORMAL);
    			Phrase libNumTrans = new Phrase("Numéro de transaction :",fontLibelle);
    			Phrase intNumTrans = new Phrase(String.valueOf(numTransaction),fontLibelle);
    			Phrase titre = new Phrase("Photo du bien",fontRed);
    			PdfPTable table = new PdfPTable(2);
    			PdfPCell cell = new PdfPCell(new Paragraph(titreEdTransaction,fontTitre));
    			Cell celltest = new Cell(cell);
    			cell.setColspan(2);
    			cell.setHorizontalAlignment(Cell.ALIGN_CENTER);
    			cell.setVerticalAlignment(Cell.ALIGN_CENTER);
    			celltest.setHeader(true);
    			table.addCell(cell);
    			table.addCell(libNumTrans);
    			table.addCell(intNumTrans);
    			table.addCell("Adresse : ");
    			table.addCell(numVoie.trim()+", "+typeVoie.trim()+" "+nomVoie.trim()+", "+codePostal.trim()+" "+commune.trim());
    			table.addCell("Négociateur : ");
    			table.addCell(prenomNego.trim()+" "+nomNego.trim());
    			table.addCell(titre);
    			//table.addCell(img);
    			document.add(table);
    			PdfPTable tableCustomized = new PdfPTable(3);
    			PdfPTable tableNested = new PdfPTable(6);
    			Phrase type = new Phrase("Type :",fontLibelle);
    			Phrase surface = new Phrase("Surface :",fontLibelle);
    			Phrase venteloc = new Phrase("Vente / Location :",fontLibelle);
    			tableNested.addCell(type);
    			tableNested.addCell(surface);
    			tableNested.addCell(venteloc);
    			tableNested.addCell("Bureau");
    			tableNested.addCell("5000 m²");
    			tableNested.addCell("Vente");
    			tableCustomized.setTotalWidth(40);
    			PdfPCell cellule = new PdfPCell(new Paragraph("test table",fontTitre));
    			cellule.setBackgroundColor(new Color(0,255,255));
    			cellule.setBorder(0);
    			tableCustomized.addCell(cellule);
    			tableCustomized.addCell("fffff");
    			tableCustomized.addCell("ddedede");
    			tableCustomized.addCell("jryjyjtjtyjtjty");
    			tableCustomized.addCell("ffhyjjuj");
    			tableCustomized.addCell(tableNested);
    			document.add(tableCustomized);
    			PdfPTable tableDyn = new PdfPTable(2);
    			tableDyn.setWidthPercentage(50);
    			//tableDyn.setHorizontalAlignment(80);
    			//tableDyn.setTotalWidth(25);
     
     
     
     
    				Phrase numTrans = new Phrase("NUM_TRANSACTION::2",fontLibelle);
    				PdfPCell celluleNumTrans = new PdfPCell(new Paragraph(numTrans));
    				celluleNumTrans.setBackgroundColor(new Color(255,0,0));
    				celluleNumTrans.setBorder(0);
    				tableDyn.addCell(celluleNumTrans);
    			        Phrase localCommune = new Phrase("LOCAL_COMMUNE::3",fontLibelle);
    				 tableDyn.addCell(localCommune);
     
    			document.add(tableDyn);
    			document.close();
    		} catch(DocumentException de){
    			System.out.println("Pb PDF : "+de);
    		}
    	}
      }
    J'ai écris directement l'arabe dans la class java mais ça pas marché .

    Merci d'avance.

  4. #4
    Membre Expert
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Septembre 2008
    Messages
    1 190
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Septembre 2008
    Messages : 1 190
    Par défaut
    Quand tu dis que ça ne marche pas, c'est à dire?
    Qu'obtiens tu?

  5. #5
    Membre éclairé
    Profil pro
    Inscrit en
    Mai 2006
    Messages
    350
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mai 2006
    Messages : 350
    Par défaut
    Je veux dire que lorsque j'écris l'arabe dans la class java, j'obtiens bien le document PDF mais vide, il n'écrit pas la chaine en arabe.

    Merci d'avance.

Discussions similaires

  1. compter l'occurence d'un mot dans un fichier pdf en arabe
    Par lamis2009 dans le forum Autres Logiciels
    Réponses: 0
    Dernier message: 30/11/2010, 21h40
  2. La sécurité dans un fichier PDF
    Par septox dans le forum Sécurité
    Réponses: 13
    Dernier message: 28/07/2006, 17h58
  3. [FPDF] ajout texte dans un fichier pdf modèle?
    Par moabomotal dans le forum Bibliothèques et frameworks
    Réponses: 1
    Dernier message: 24/06/2006, 16h36
  4. [FPDF] Edition de listings dans un fichier PDF en PHP ?
    Par nerick dans le forum Bibliothèques et frameworks
    Réponses: 16
    Dernier message: 22/03/2006, 09h53

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo