LOL. The CreatePDF procedure below successfully creates a my  PDF. It also 
hooks up the table event but couldn't make it further than tat.  
....     Dim myevent As New PdfPTableEvents
         my_pdf_tbl.setTableEvent(myevent)

MyEventhandler does not work however. I just want to iterate over each row and 
column to get the text and the x,y cords. 

The task I have is not much more difficult than that.  Inside the Event handler 
I want to 
get the coordinates of text as well as write text to other file formats. These 
other formats are not priorities so I am laying the groundwork 
for being able to quickly convert from PDF to these other file formats.  

As far as technique, TableLayouts  it is the recommended and easiest way to 
accomplish this according to the examples in the ItextSharp exercises on 
Sourceforge. It seems to be manageable.  But the example does so much with 
colors and rotations and all, I can't pick out the exact code I need.   So 
example would be appreciated. 


Thanks for quick responses. 



> Show us your PDF. We'll poke around and see what we can see. You might
> be building the
> form inefficiently, in which case a code change on your end may produce
> similar results.
> Might not, too... but we can't tell unless we see a PDF.
> 
> [rodney.williams]
> 1. Can someone provide code in either C# or Java ( I can usually
> translate into vb.net)  which simply fires a table event where I can
> iterate through each row and column. My understanding is that table
> layout and canvassing is involved. If we can build on the code I
> provided, I hope the code will be simple.  I provided  a working
> CreatePDF but  The PDF Event procedure is one I tried to make work but
> couldn't. My goal is to get the x,y coordinates as well as the text
> from the fields to create and other some other file types.
> 
> >> What was the first question? You've presented some code.
> >> Does it work? Or is there a problem with it?
> >> It's hard to tell because it's written in VB.NET,
> >> and I don't know VB.NET. If also failed to find a question.
> >>
> 
> > I would like to fire an event to iterate through the rows and columns
> > of pdfptable  to get celltext as well as coordinates.
> >
> > This satisfies 2 of my needs:
> >
> > 1.       With x,y coordinates I can write lines and dividers back to
> > report based on key words
> >
> > 2.       I create Excel and HTML files from table data
> >
> > The examples I find are far more complex than I need to accomplish my
> > simple need.
> > Here is code I have so far.  It is written in VB.NET but I can
> convert
> > C# to VB.NET
> >
> >
> > ' Using Itextsharp not itext so some methods may differ
> >
> > Public Sub CreatePDF()
> >     Dim doc As New Document
> >     PdfWriter.GetInstance(doc, New FileStream("myfile.pdf",
> > FileMode.Create))
> >     doc.Open()
> >     Dim my_pdf_tbl As PdfPTable
> >     my_pdf_tbl = New PdfPTable(3)   ' contains 3 rows
> >     my_pdf_tbl.WidthPercentage = 100.0F
> >     my_pdf_tbl.DefaultCell.Border = PdfCell.NO_BORDER
> >     my_pdf_tbl.AddCell("Date")
> >     my_pdf_tbl.AddCell("Sales")
> >     my_pdf_tbl.AddCell("Guests")
> >     my_pdf_tbl.HeaderRows = True    'End of table header
> >     my_pdf_tbl.AddCell("0/21/2009")
> >     my_pdf_tbl.AddCell("2345.09")
> >     my_pdf_tbl.AddCell("17")
> >     my_pdf_tbl.AddCell("0/21/2009")
> >     my_pdf_tbl.AddCell("2345.09")
> >     my_pdf_tbl.AddCell("17")
> >     doc.Add(my_pdf_tbl)
> >     Dim myevent As New PdfPTableEvents
> >     my_pdf_tbl.setTableEvent(myevent)
> >     ' add the table with document add
> >     doc.Add(my_pdf_tbl)
> >      ' add the table at an absolute position
> >     my_pdf_tbl.WriteSelectedRows(0, -1, 100, 600,
> > PdfWriter.getdirectcontent
> >     doc.Close()
> > End Sub
> >
> > Public Class PdfPTableEvents
> >     Implements PdfPTableEvent
> >     '
> >     Public Sub tableLayout(ByVal table As PdfPTable, ByVal width()()
> As
> > Double, ByVal height()() As Double)
> >         Dim sOutputTemplate As String = " Text is {0} : x-pos is {1}
> :
> > y-pos is {2} : cell height is {3} : cell width is {4}"
> >         For i As Integer = 0 To 3
> >             For j As Integer = 0 To 3
> >                 ' I will write Values to Excel file here
> >                debug.Writeline(string.Format(sOutputTemplate, text,
> x,
> > y, width, height)
> >             Next j
> >         Next i
> >     End Sub
> >
> > End Class
> >
> 
>  [rodney.williams]
> Yes, the calculations are done by the program and are placed in the PDF
> Table. I can't find examples anywhere of continuous horizontal scroll
> as you would do in Excel. This is not related to the first question.
> 

------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
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/

Reply via email to