This is an easy one. Your first pdf is rgb and the second one is cmyk. If you want to produce the second pdf use an instance of CMYKColor.

Paulo

----- Original Message ----- From: "Arthur Gober" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, April 03, 2006 9:37 PM
Subject: [iText-questions] color black


Dear Itext,

The attached program, jpdfmain.java, produced a pdf
file, test01.pdf, which has a line of text on the page
written in the color black. However, when the document
is looked at in Adobe Acrobat 7.0, (menu items-
tools/print production/output preview) - see attached
file 0604031557.jpg - the text does NOT consist only
of black.

After applying a conversion process within Acrobat
(menu items - tools/print production/convert colors) -
see attached file 0604031600.jpg - the text does
consist only of black. The modified pdf file is
test01fixed.pdf.

I would appreciate if you could tell how this could be
achieved using the itext library classes/methods.

Thanks very much.

Arthur Gober



--------------------------------------------------------------------------------






--------------------------------------------------------------------------------






--------------------------------------------------------------------------------


package jpdf;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import com.lowagie.text.Document;
import com.lowagie.text.DocumentException;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.BaseFont;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfWriter;

public class jpdfmain
{
   String recbuf="THIS IS A LINE OF BLACK TEXT";


   jpdfmain(String outflspc1)
   {
       try
           {
Document document = new Document(new Rectangle(800,500), 50, 50, 50, 50); PdfWriter writer = PdfWriter.getInstance(document, new FileOutputStream(outflspc1));
               document.open();
               PdfContentByte cb = writer.getDirectContent();

               cb.setRGBColorFill(0,0,0);

               cb.beginText();
BaseFont bf=BaseFont.createFont("c:\\windows\\fonts\\ARIALBD.ttf",BaseFont.CP1252,
                       BaseFont.NOT_EMBEDDED);
//BaseFont bf=BaseFont.createFont(BaseFont.HELVETICA,BaseFont.CP1252,BaseFont.NOT_EMBEDDED);
               //Font font = new Font(bf,fontszttl,Font.BOLD);
               cb.setFontAndSize(bf,35);
               cb.setTextMatrix((float)50,(float)300);
               cb.showText(recbuf);
               cb.endText();
               document.close();
           }
       catch (FileNotFoundException e1)
           {
System.out.println("file not found:"+outflspc1+":"+outflspc1);
               System.exit(99);
           }
       catch (IOException io1)
           {
               System.out.println(io1.getMessage());
               System.exit(97);
           }
       catch (DocumentException d1)
           {
               System.out.println(d1.getMessage());
               System.exit(98);
           }

   }//end constructor



   public static void main(String[] args)
       {
           String outfl="";
           if (args.length<1)
               {
                   System.out.println("java jpdfmain outflspec");
                   System.exit(999);
               }
           outfl = args[0].trim();
           new jpdfmain(outfl);
           System.out.println("*** normal termination ***");
           System.exit(0);

       }

}




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to