On 6/09/2010 12:45, ff441 wrote:
>
> Hi,
>
> I would like to add a text with pdfcontentbyte.
>
> This is my code :
>
>
> Protected Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs)
>
> Dim doc1 As New Document
>
>
> 'use a variable to let my code fit across the page...
>
> Dim path As String
> path = Server.MapPath("PDFs")
>
> PdfWriter.GetInstance(doc1, New FileStream(path + "/Doc12.pdf",
> FileMode.Create))
>
> doc1.Open()
>
> Dim cb As PdfContentByte =
> iTextSharp.text.pdf.PdfWriter.DirectContent
>
>
>
> But in this line Dim cb As PdfContentByte =
> iTextSharp.text.pdf.PdfWriter.DirectContent I get an error .In fact
> DirectContent is not available.
I can only explain in Java terms what you are doing wrong.
You get an instance of a PdfWriter as an unnamed object.
You should get a named object, such as:
var writer = PdfWriter.GetInstance(doc1, New FileStream(path +
"/Doc12.pdf", FileMode.Create));
Then you should ask that object (NOT the class) for its DirectContent.
--
This answer is provided by 1T3XT BVBA
http://www.1t3xt.com/ - http://www.1t3xt.info
------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:
Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.itextpdf.com/book/
Check the site with examples before you ask questions:
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/