Hello

I'am using the same code as Simon for printing a watermark. the only 
difference is the use of PdfGState to set transparency. the watermark is 
visible on the pdf but newer printed. This is not dependent from the 
colorFill settings. Not setting the GState works fine.

Can somebody give me a hint?

Here my code:

PdfGState gs1 = new PdfGState();
gs1.setFillOpacity(0.5f);
cb.saveState();
cb.setGState(gs1);
cb.beginText();
cb.setGrayFill(0.5f);
cb.setFontAndSize(baseFont, 48);
cb.setColorFill(Color.lightGray);
cb.showTextAligned(PdfContentByte.ALIGN_CENTER, "watermarkText", 
PageSize.A4.height() / 2, PageSize.A4.width() / 2, 45);
cb.setColorFill(Color.black);
cb.endText();
cb.restoreState();

Thanks, Marco

-----Original Message-----
From: Paulo Soares [mailto:[EMAIL PROTECTED]
Sent: 24 March 2004 10:49
To: Sherlock Simon; [EMAIL PROTECTED]
Subject: RE: [iText-questions] Centring watermark


You don't have to calculate anything. Try:

cb.showTextAligned(PdfContentByte.ALIGN_CENTER, watermarkText,
PageSize.A4.width() / 2, PageSize.A4.height() / 2,45);

Best Regards,
Paulo Soares

> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On 
> Behalf Of Sherlock Simon
> Sent: Tuesday, March 23, 2004 3:35 PM
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] Centring watermark
> 
> I'm using the following to display my watermark (text) rotated at 45
> degrees.
> 
> BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA_BOLD, 
> BaseFont.CP1252,
>       
> BaseFont.NOT_EMBEDDED);
> PdfContentByte cb = docWriter.getDirectContentUnder();
> cb.beginText();
> cb.setFontAndSize(bf, 38);
> cb.setColorFill(Color.lightGray);
> cb.showTextAligned(PdfContentByte.ALIGN_CENTER, 
> watermarkText, 250, 350,
> 45);
> cb.endText();
> 
> What I want to do is make sure it is centred on the page.  I 
> saw an example
> of calculating the attributes depending on the degree of 
> rotation but cannot
> find it.  Could anybody give me some pointers?
> 
> Thanks, Simon
> 
> 

---
sunrise ADSL
Aufgrund grosser Nachfrage: sunrise ADSL Null-Franken-Angebot verl�ngert bis Ende 
April 2004!
http://internet.sunrise.ch/de/internet/int_ads.asp
---
sunrise ADSL
En raison de la forte demande: offre sunrise ADSL � CHF 0.- prolong�e jusqu'� fin 
avril 2004!
http://internet.sunrise.ch/fr/internet/int_ads.asp
---
sunrise ADSL
Considerando la grande domanda, l'offerta sunrise ADSL a zero franchi sar� prolungata 
sino a fine aprile 2004!
http://internet.sunrise.ch/it/internet/int_ads.asp
---




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to