Writting Text on Images

View: New views
7 Messages — Rating Filter:   Alert me  

Writting Text on Images

by debasishpramanik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All:

I'm trying to use iTextSharp for watermarking the pdf file. The problem is that it work great if the PDF file contains text but if the PDf file contain images, the text written as part of Watermarking doesn't displays.

Does anyone know what to do to write text on images?

Regards
Debasish Pramanik

Re: Writting Text on Images

by Elrinth :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I'm not sure what your trying to do exactly.
But use the PdfContentByte and write the text the last thing you do in the document page. That which is added last will come up in the upmost layer.
example:
PdfContentByte cb = writer.DirectContent; // writer is grabbed from the PdfDocument
// writing text
        cb.BeginText();
        cb.SetFontAndSize(bf, 12); // bf is a BaseFont
        cb.SetColorFill(new Color(0x33, 0x33, 0xff));
        cb.SetTextMatrix(45, 740); // x counted from left... y counted from bottom of page and up.
        cb.ShowText("This is my text"); // set position in document
        cb.EndText();

Oh and there's also layers, I haven't tried using them myself, but maybe you can use them and set some z-index with them?

Kind regards, Elrinth

Re: Writting Text on Images

by Paulo Soares-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Write the text over the image.

Paulo

> -----Original Message-----
> From: debasishpramanik [mailto:debasish.pramanik@...]
> Sent: Tuesday, June 09, 2009 11:33 AM
> To: itextsharp-questions@...
> Subject: [itextsharp-questions] Writting Text on Images
>
>
> Hi All:
>
> I'm trying to use iTextSharp for watermarking the pdf file.
> The problem is
> that it work great if the PDF file contains text but if the
> PDf file contain
> images, the text written as part of Watermarking doesn't displays.
>
> Does anyone know what to do to write text on images?
>
> Regards
> Debasish Pramanik

Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: Writting Text on Images

by Dominic Clark :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi there,

I have a document that has multiple paragrpahs in it which is rendered
in html, I need to create a new page in the existing pdf and add that
text to the page without losing the html formatting, i.e ul/li etc and
display that on the last page.

I've tried trying to create a pdf and merge the two pdfs but the
formatting of the pages were all out of sync, while some pages that do
not show margins etc originally, now started to. I need to import the
page without any formatting changes.

Is it possible? If not do you know any other solutions?

Dom

-----Original Message-----
From: Elrinth [mailto:elrinth@...]
Sent: 09 June 2009 12:37
To: itextsharp-questions@...
Subject: Re: [itextsharp-questions] Writting Text on Images


I'm not sure what your trying to do exactly.
But use the PdfContentByte and write the text the last thing you do in
the
document page. That which is added last will come up in the upmost
layer.
example:
PdfContentByte cb = writer.DirectContent; // writer is grabbed from the
PdfDocument
// writing text
        cb.BeginText();
        cb.SetFontAndSize(bf, 12); // bf is a BaseFont
        cb.SetColorFill(new Color(0x33, 0x33, 0xff));
        cb.SetTextMatrix(45, 740); // x counted from left... y counted
from
bottom of page and up.
        cb.ShowText("This is my text"); // set position in document
        cb.EndText();

Oh and there's also layers, I haven't tried using them myself, but maybe
you
can use them and set some z-index with them?

Kind regards, Elrinth
--
View this message in context:
http://www.nabble.com/Writting-Text-on-Images-tp23940310p23941105.html
Sent from the itextsharp-questions mailing list archive at Nabble.com.


------------------------------------------------------------------------
------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

________________________________________________________________________
This e-mail has been scanned for all viruses by Star.
________________________________________________________________________

------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: Writting Text on Images

by debasishpramanik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

thanks for the response. But the question is how should I write over the image? Please help.


Paulo Soares-3 wrote:
Write the text over the image.

Paulo

> -----Original Message-----
> From: debasishpramanik [mailto:debasish.pramanik@Assetlink.com]
> Sent: Tuesday, June 09, 2009 11:33 AM
> To: itextsharp-questions@lists.sourceforge.net
> Subject: [itextsharp-questions] Writting Text on Images
>
>
> Hi All:
>
> I'm trying to use iTextSharp for watermarking the pdf file.
> The problem is
> that it work great if the PDF file contains text but if the
> PDf file contain
> images, the text written as part of Watermarking doesn't displays.
>
> Does anyone know what to do to write text on images?
>
> Regards
> Debasish Pramanik


Aviso Legal:

Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.



Disclaimer:

This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.




------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: Writting Text on Images

by Paulo Soares-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In the OnEndPage write the text to the DirectContent, it will always be on top.

Paulo

> -----Original Message-----
> From: debasishpramanik [mailto:debasish.pramanik@...]
> Sent: Tuesday, June 09, 2009 5:11 PM
> To: itextsharp-questions@...
> Subject: Re: [itextsharp-questions] Writting Text on Images
>
>
> thanks for the response. But the question is how should I
> write over the
> image? Please help.
>
>
>
> Paulo Soares-3 wrote:
> >
> > Write the text over the image.
> >
> > Paulo
> >
> >> -----Original Message-----
> >> From: debasishpramanik [mailto:debasish.pramanik@...]
> >> Sent: Tuesday, June 09, 2009 11:33 AM
> >> To: itextsharp-questions@...
> >> Subject: [itextsharp-questions] Writting Text on Images
> >>
> >>
> >> Hi All:
> >>
> >> I'm trying to use iTextSharp for watermarking the pdf file.
> >> The problem is
> >> that it work great if the PDF file contains text but if the
> >> PDf file contain
> >> images, the text written as part of Watermarking doesn't displays.
> >>
> >> Does anyone know what to do to write text on images?
> >>
> >> Regards
> >> Debasish Pramanik

Aviso Legal:
Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.

Disclaimer:
This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.



------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@...
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions

Re: Writting Text on Images

by debasishpramanik :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hey the problem got solved. I was using PdfStamper.GetunderContent instead of that use GetOvercontent. It works. thanks all for your help...



thanks for the response. But the question is how should I write over the image? Please help.


Paulo Soares-3 wrote:
Write the text over the image.

Paulo

> -----Original Message-----
> From: debasishpramanik [mailto:debasish.pramanik@Assetlink.com]
> Sent: Tuesday, June 09, 2009 11:33 AM
> To: itextsharp-questions@lists.sourceforge.net
> Subject: [itextsharp-questions] Writting Text on Images
>
>
> Hi All:
>
> I'm trying to use iTextSharp for watermarking the pdf file.
> The problem is
> that it work great if the PDF file contains text but if the
> PDf file contain
> images, the text written as part of Watermarking doesn't displays.
>
> Does anyone know what to do to write text on images?
>
> Regards
> Debasish Pramanik


Aviso Legal:

Esta mensagem é destinada exclusivamente ao destinatário. Pode conter informação confidencial ou legalmente protegida. A incorrecta transmissão desta mensagem não significa a perca de confidencialidade. Se esta mensagem for recebida por engano, por favor envie-a de volta para o remetente e apague-a do seu sistema de imediato. É proibido a qualquer pessoa que não o destinatário de usar, revelar ou distribuir qualquer parte desta mensagem.



Disclaimer:

This message is destined exclusively to the intended receiver. It may contain confidential or legally protected information. The incorrect transmission of this message does not mean the loss of its confidentiality. If this message is received by mistake, please send it back to the sender and delete it from your system immediately. It is forbidden to any person who is not the intended receiver to use, distribute or copy any part of this message.




------------------------------------------------------------------------------
Crystal Reports - New Free Runtime and 30 Day Trial
Check out the new simplified licensing option that enables unlimited
royalty-free distribution of the report engine for externally facing
server and web deployment.
http://p.sf.net/sfu/businessobjects
_______________________________________________
itextsharp-questions mailing list
itextsharp-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itextsharp-questions