Hi,

 

I’m using iTextSharp v4.0.4 to create my PDF. I’m trying to add a text on
every page when my users wants to have a preview. I’m doing like this :

 

public class PDFListener : PdfPageEventHelper

{

    /** This is the contentbyte object of the writer */

    private PdfContentByte cbPreview;

    

    public override void OnOpenDocument(PdfWriter writer, Document document)

    {

         cbPreview = writer.DirectContent;

    }

 

    public override void OnEndPage(PdfWriter writer, Document document)

    { 

         cbPreview.SaveState();

         cbPreview.BeginText();

         cbPreview.SetFontAndSize(Font14Bold.BaseFont, 150);

         cbPreview.SetColorFill(new Color(200, 0, 0, 200));

         cbPreview.SetTextMatrix(0.5f, 0.5f, -0.5f, 0.5f, (PageSize.A4.Width
/ 2) - 100, (PageSize.A4.Height / 2) - 100);

         cbPreview.ShowText("PREVIEW");

         cbPreview.EndText();

         cbPreview.RestoreState();

    }

}

 

The problem is that the text does not use the Alpha parameter for the Color.
I’d like to have the “Preview” to be in top of document, but with
transparency. 

 

Is there a way to do this ?

 

Thanks for the help.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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