I just started to evaluate DynamicPDF. I cannot make a very simple task work. I want to open an existing PDF document and loop through all elements of all pages. I tried something like
Dim pdf As ceTe.DynamicPDF.Merger.MergeDocument
Dim pg As ceTe.DynamicPDF.Page
Dim el As ceTe.DynamicPDF.PageElement
pdf = New MergeDocument("C:\Temp\test.pdf")
pg = pdf.Pages.Item(0)
For Each el In pg.Elements
Next
However, there the Elements list is always empty. It's count is 0.
Michael
Looping through all elements
Re: Looping through all elements
Support · Feb 5, 2007Hello Michael,
In order to loop through all the form field elements in a document you will have to use the Form.Fields property of the PdfDocument object. You can refer to the FormFieldReader example which reads all the form field values. Following is some sample code.
Dim pdfdoc As New PdfDocument("D:\Attachments\DocumentA.pdf")
Dim merdoc As New MergeDocument(pdfdoc)
Dim list As PdfFormFieldList = pdfdoc.Form.Fields
Dim name As String
For i As Integer = 0 To i < list.Count - 1
name = list(i).FullName
Next
Thanks,
ceTe Software Support Team.
Re: Looping through all elements
Forum member · Feb 5, 2007Thanks a lot for the answer.
I do not want to loop through the fields. I want to iterate all elements belonging to a page. Suppose this forum post were a PDF document, I want to to be told...
[1] There is a paragraph. It is a text element. It's text reads "Thank's a lot for the answer".
[2] There is a paragraph. It is a text element. It's text reads "I do not want..."
Simply said, my program should read the entire PDF document. It should find out about the structure, and it should look at all text belongig to a page. From the documentation I understood that the Elements list were to be used for that task.
Michael G. Schneider
Re: Looping through all elements
Support · Feb 5, 2007Hello Michael,
It is not possible to access the page elements or to read the contents from an existing PDF document. You can know the number of elements added by our product only. You can only read the FormField values and can change the values.
Thanks,
ceTe Software Support Team.
Re: Looping through all elements
Forum member · Feb 18, 2007Michael:
Please let me know if you find software that allows you to iterate all the elements in a PDF page. I need that type of functionality too. Thanks! al(at)trans-micro.com