I'm not sure that there is a bug and it certainly is not here. WMF just
can't be used with the simple watermark interface, WMF requires an open
document. It can be done as easily with a page event and don't tell me
that's difficult to use.
As an extension to your other post you don't have to use the addWatermark(),
it's not suited to what you want to do.
Best Regards,
Paulo Soares
> -----Original Message-----
> From: Gerald Fehringer [SMTP:[EMAIL PROTECTED]
> Sent: Wednesday, March 26, 2003 13:32
> To: [EMAIL PROTECTED]
> Subject: [iText-questions] bug fix WMF as watermark ?
>
> Hello iText users!
>
> I tried to use a WMF as watermark which gave problems.
> Below you will a find modified version of the PdfContentByte.addImage()
> method which now allows to have a WMF as watermark (but I'm not satisfied
> with that bug fix since it would always create a new instance of an image
> and not reusing it):
>
> /**
> * Adds an <CODE>Image</CODE> to the page. The positioning of the
> <CODE>Image</CODE>
> * is done with the transformation matrix. To position an
> <CODE>image</CODE> at (x,y)
> * use addImage(image, image_width, 0, 0, image_height, x, y).
> * @param image the <CODE>Image</CODE> object
> * @param a an element of the transformation matrix
> * @param b an element of the transformation matrix
> * @param c an element of the transformation matrix
> * @param d an element of the transformation matrix
> * @param e an element of the transformation matrix
> * @param f an element of the transformation matrix
> * @throws DocumentException on error
> */
> public void addImage(Image image, float a, float b, float c, float d,
> float e, float f) throws DocumentException {
> try {
>
> if (image.isImgTemplate()) {
> if( image instanceof com.lowagie.text.Watermark )
> {
> image = new com.lowagie.text.ImgWMF(image.url());
> }
> writer.addDirectImageSimple(image);
> PdfTemplate template = image.templateData();
> float w = template.getWidth();
> float h = template.getHeight();
> addTemplate(template, a / w, b / w, c / h, d / h, e, f);
> }
> else {
> PdfName name;
> PageResources prs = getPageResources();
> Image maskImage = image.getImageMask();
> if (maskImage != null) {
> name = writer.addDirectImageSimple(maskImage);
> prs.addXObject(name, writer.getImageReference(name));
> }
> name = writer.addDirectImageSimple(image);
> name = prs.addXObject(name, writer.getImageReference(name));
> content.append("q ");
> content.append(a).append(' ');
> content.append(b).append(' ');
> content.append(c).append(' ');
> content.append(d).append(' ');
> content.append(e).append(' ');
> content.append(f).append(" cm ");
> content.append(name.toPdf(null)).append(" Do Q").append_i(separator);
> }
> }
> catch (Exception ee) {
> throw new DocumentException(ee.getMessage());
> }
> }
>
> Kind regards,
> Gerald.
-------------------------------------------------------
This SF.net email is sponsored by:
The Definitive IT and Networking Event. Be There!
NetWorld+Interop Las Vegas 2003 -- Register today!
http://ads.sourceforge.net/cgi-bin/redirect.pl?keyn0001en
_______________________________________________
iText-questions mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/itext-questions