Thanks Bruno,

This is the code. The problem start in the paragraph "paragraphDocteurs", the 
font used is  stFont and is set in the 
constructor.

Pierre

public class LettreGenerateur {
    private static LettreGenerateur instance;
    private static Font stFont = FontFactory.getFont(FontFactory.HELVETICA, 6, 
Font.NORMAL, new Color(0, 0, 0));
    private static Font grasFont = FontFactory.getFont(FontFactory.HELVETICA, 
8, Font.BOLD, new Color(0, 0, 0));
    private static Font fontTable = FontFactory.getFont(FontFactory.HELVETICA, 
4, Font.NORMAL, new Color(0, 0, 0));
    private static SimpleDateFormat dateFormat = new SimpleDateFormat 
("dd.MM.yyyy");
    private  Consultation consultation;

    private LettreGenerateur() {
    }


    public static LettreGenerateur getInstance() {
      if (instance == null) {
        instance = new LettreGenerateur();
      }

      return instance;
    }
    public void generateLettre(Consultation consultation) throws Exception
    {
      this.consultation = consultation;
      Document document = null;
      try {
        document = new Document(PageSize.A4,
                    50.0f, 50.0f, 50.0f, 50.0f);
        PdfWriter.getInstance(document,
                              new FileOutputStream("consultation\\L" + 
consultation.numeroDeConsultation().toString() 
+".pdf"));
        document.addAuthor("Pierre Gilquin");
        document.addCreator("Pierre Gilquin");
        document.addSubject("Consultation");
        document.addTitle("Consultation");

        Phrase phraseEn = new Phrase(32/* 47*/,
            new Chunk("Département d'anesthésiologie, pharmacologie et soins 
intensifs",
                      FontFactory.getFont(FontFactory.HELVETICA, 6, Font.BOLD,
                                          new Color(0, 0, 0))));
        Image image2 = 
Image.getInstance(Resources.class.getResource("logo_hug.gif"));
        image2.setAlignment(Image.ALIGN_RIGHT);
        image2.scaleAbsolute(107.5f, 37.5f);
        phraseEn.add(new Chunk(image2, 140, -8));

        HeaderFooter footer = new HeaderFooter(new Phrase(10, "Service de 
Pharmacologie et Toxicologie cliniques - 
Hôpitaux Universitaires Genève - Rue Micheli-du-Crest 24 CH - 1211 Genève 14 \n 
"
            + "Téléphone 022 382 99 36 - Téléfax 022 382 99 45",
            stFont), false);

        footer.setAlignment(footer.ALIGN_CENTER);
        document.setHeader(new HeaderFooter(phraseEn, false));
        document.setFooter(footer);
        document.open();

        Paragraph paragraphDocteurs = new Paragraph(
            "Service de Pharmacologie et Toxicologie cliniques\n",
            stFont);
        Phrase el1 = new Phrase("Prof. P. Dayer, médecin chef de service\n");
        Phrase el2 = new Phrase(
            "Centre d'informations thérapeutiques et de pharmacovigilance\n",
            grasFont);
        Phrase el3 = new Phrase(
            "Dr J. Desmeules, CC, médecin adjoint agrégé responsable du 
centre\n");
        Phrase el4 = new Phrase("Dr V. Piguet, médecin adjointe\n");
        Phrase el5 = new Phrase("Dr M. Escher-Imhof, médecin adjointe\n");
        Phrase el6 = new Phrase("Dr M. Besson, cheffe de clinique\n");
        Phrase el7 = new Phrase("Dr V. Rollason, cheffe de projet\n");
        paragraphDocteurs.add(el2);
        paragraphDocteurs.add(el1);
        paragraphDocteurs.add(el3);
        paragraphDocteurs.add(el4);
        paragraphDocteurs.add(el5);
        paragraphDocteurs.add(el6);
        paragraphDocteurs.add(el7);

        document.add(paragraphDocteurs);

.......

----- Original Message ----- 
From: "Bruno Lowagie" <[EMAIL PROTECTED]>
To: "Post all your questions about iText here" 
<[email protected]>
Sent: Friday, May 16, 2008 11:15 AM
Subject: Re: [iText-questions] Change of font/size


> Pierre Gilquin wrote:
>> Hi ,
>>
>> I generated a letter using data from database. In some circumstance
>> (that I don't understand), some static text (not from DB) change their
>> sizes,
>> I attached to picture to make it clearer.
>
> That doesn't clarify the problem. Are you embedding the font?
> What about sending two PDFs so that we can compare? (It would be
> interesting to see what font is used and what the content stream
> looks like internally.) What about sending us a code sample so
> that we can reproduce the problem?
>
>> Thanks in advance for any idea or way to debug the problem.
>
> He who has the code, can debug; he who doesn't have the code,
> can only guess.
> br,
> Bruno
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2008.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
>
> Do you like iText?
> Buy the iText book: http://www.1t3xt.com/docs/book.php
> Or leave a tip: https://tipit.to/itexttipjar 


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft 
Defy all challenges. Microsoft(R) Visual Studio 2008. 
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Do you like iText?
Buy the iText book: http://www.1t3xt.com/docs/book.php
Or leave a tip: https://tipit.to/itexttipjar

Reply via email to