Maybe the image is too big.

Paulo

----- Original Message ----- 
From: "Adam Kapelner" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, January 07, 2007 10:49 PM
Subject: [iText-questions] image + text


> Hello,
>
> Simple question. The following code produces the title on page 1, followed 
> by
> the image on page 2, followed by another paragraph on page 3. I want to 
> have
> all three components on one page. I tried using "setSpacingAfter" but it 
> didn't
> work. Here's the code:
>
> private void GeneratePDF() throws Exception {
> document=new Document(PageSize.LETTER, 50, 50, 50, 50);
> PdfWriter writer=PdfWriter.getInstance(document,new
> FileOutputStream(reportFilenameFull()));
> writer.setStrictImageSequence(true);
> document.open();
>
> subTitleFont=FontFactory.getFont
> (FontFactory.TIMES,18,Font.BOLD,Color.BLACK);
>
> AddTitle();
> AddThumbnailImage();
> AddSummary();
> AddCalls();
>
> document.close();
> }
> private void AddTitle() throws Exception {
> Font titleFont=FontFactory.getFont
> (FontFactory.TIMES,36,Font.BOLD,Color.BLACK);
> Paragraph title=new Paragraph
> (Run.it.projectName+"\n",titleFont);
> document.add(title);
> }
> private void AddThumbnailImage() throws Exception {
> //"getGlobalThumbnailImage" returns a BufferedImage of width
> thumbWidth
> Image image=Image.getInstance(Thumbnails.getGlobalThumbnailImage
> (thumbWidth),null);
> document.add(image);
> }
> private void AddSummary() throws Exception {
>
> Font elementFont=FontFactory.getFont
> (FontFactory.COURIER,12,Font.NORMAL,Color.BLACK);
>
> NumberFormat format=NumberFormat.getInstance();
> format.setMinimumFractionDigits(2);
> format.setMaximumFractionDigits(2);
>
> if (totalCounts != null && errorRates == null){
> Paragraph subTitleCounts=new Paragraph
> ("Counts\n",subTitleFont);
> for (String phenotype:totalCounts.keySet())
> subTitleCounts.add(new Phrase
> ("\t"+phenotype+": "+totalCounts.get(phenotype)+"\n",elementFont));
> document.add(subTitleCounts);
> }
> else if (errorRates != null && totalCounts == null){
> Paragraph subTitleErrors=new Paragraph("Error
> Rates\n",subTitleFont);
> for (String phenotype:errorRates.keySet())
> subTitleErrors.add(new Phrase
> ("\t"+phenotype+": "+format.format(errorRates.get(phenotype))+"%
> \n",elementFont));
> document.add(subTitleErrors);
> }
> else if (totalCounts != null && errorRates != null){
> Paragraph subTitleCounts=new Paragraph("Counts\t\tError
> Rates\n",subTitleFont);
> for (String phenotype:totalCounts.keySet())
> subTitleCounts.add(new Phrase
> ("\t"+phenotype+": "+totalCounts.get(phenotype)+"\t\t"+format.format
> (errorRates.get(phenotype))+"%\n",elementFont));
> document.add(subTitleCounts);
> }
> }
> private void AddCalls() throws Exception {
>
> Font callFont=FontFactory.getFont
> (FontFactory.COURIER,14,Font.NORMAL,Color.BLACK);
> Font outputFont=FontFactory.getFont
> (FontFactory.COURIER,12,Font.NORMAL,new Color(0,144,0));
>
> if (calls != null){
> if (calls.size() > 0){
> Paragraph callsSec=new Paragraph
> ("Analysis\n",subTitleFont);
> for (String call:calls.keySet()){
> callsSec.add(new Phrase
> ("\t"+call+"\n",callFont));
> callsSec.add(new Phrase("\t\t"+calls.get
> (call)+"\n",outputFont));
> }
> document.add(callsSec);
> }
> }
> }
>
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share 
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/ 


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/

Reply via email to