pdf rendering and text search

selvamarcadu

Member
Joined
Jul 7, 2009
Messages
17
Programming Experience
Beginner
Hi all,

I am newbie in vb.net and have been involved in designing a windows application.

I want to render the pdf document within vb.net form and highlight certain keywords.I read about AxAcroPDFLib.AxAcroPDF and tested it, but it does not seem to give text searching capability.I will be happy to get your sugestions to render pdf pages, with text highlighted for certain keywords.
 

ScottyB

Active member
Joined
Jan 27, 2007
Messages
40
Location
Australia
Programming Experience
5-10

selvamarcadu

Member
Joined
Jul 7, 2009
Messages
17
Programming Experience
Beginner
Hi all,

I just went to check AxAcroPDFLib.I added acrobat reader com object to tool box.Then dragged it to form.But simply running it gives "Windowless controls are not supported".What does it mean?,Do i need any additional dll?

I have Adobe 7.0 installed in my machine.


Thanks,
Selvam
 

selvamarcadu

Member
Joined
Jul 7, 2009
Messages
17
Programming Experience
Beginner
multiple pdf files in child forms

Hi,
After i used acrobat 9.x(AxAcroPDFLib.AxAcroPDF)

1)I included its com and added to toolbox

2)I dropped Acrobat Reader to My main form(frmMain)

3)Then i did, I frmMain.AxAcroPDF1.LoadFile(...)

4) ChildForm.Controls.Add(frmMain.AxAcroPDF1)

But the problem is there are multiple mdi childs for the main form.I need to load multiple pdf files for them.But when i load the second mdi child, the first mdi child's pdf content becomes empty.

Note:childforms are created dynamically

Help me to load multiple pdf files for each child form.

Thanks
Selvam
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,583
Location
Norway
Programming Experience
10+
You'd want to create one control for each form, similar to this:
VB.NET:
Dim pdf As New AxAcroPDF
pdf.Loadfile(...)
theForm.Controls.Add(pdf)
 

selvamarcadu

Member
Joined
Jul 7, 2009
Messages
17
Programming Experience
Beginner
Hi thanks JohnH,

I tried it,but "System.Windows.Forms.AxHost+InvalidActiveXStateException" is thrown

My code looks as,

Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
Dim pdf As New AxAcroPDFLib.AxAcroPDF
pdf.OcxState = CType(resources.GetObject("AxAcroPDF1.OcxState"), System.Windows.Forms.AxHost.State)
pdf.LoadFile("path_to_pdf")
ChildForm.Controls.Add(pdf)
ChildForm.Show(DockPanel)


When i place the Adobe Reader control in frmMain ,i could access it.But,when i create a new one it throws such exception.
 

selvamarcadu

Member
Joined
Jul 7, 2009
Messages
17
Programming Experience
Beginner
Hi ,its working now,thanks for your support.

I first showed the form and then loaded the file.

Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmMain))
Dim pdf As New AxAcroPDFLib.AxAcroPDF
pdf.OcxState = CType(resources.GetObject("AxAcroPDF1.OcxState"), System.Windows.Forms.AxHost.State)

ChildForm.Show(DockPanel) 'This is the line i brought up
pdf.LoadFile("path_to_pdf")

ChildForm.Controls.Add(pdf)


Thanks
Selvam
 

excitive

New member
Joined
Apr 7, 2015
Messages
1
Programming Experience
5-10
I see that there has been some years but, can anyone help regarding highlighting a word on the PDF (after successfully putting the control on form and loading the file)...? i.e. We pass a string to the control and that gets highlighted throughout the PDF inside the viewer?

Thanks
excitive
 
Top Bottom