Hi,
How can i open a PDF file in Form instead of using a shell to open it?
Also i want to select some text in the opened PDF file and store it in a variable.

Thank you.

Hi,
How can i open a PDF file in Form instead of using a shell to open it?
Also i want to select some text in the opened PDF file and store it in a variable.

Thank you.

Adobe provides documentation on how to do this using their API and a javascript object. You need Acrobat professional on your computer to perform certain operations. As far as reading, I'm sure there is a way to do this with just adobe reader.

http://www.adobe.com/devnet/acrobat/pdfs/VBJavaScript.pdf
www.adobe.com/devnet/acrobat/pdfs/AcroJS.pdf

Probably the easiest way to do what you want is to use a Browser control on your form and open the PDF file in the browser - Browser1.Navigate PDFFile$ - works like a charm and you're not tied to a particular version of Acrobat Reader.

Probably the easiest way to do what you want is to use a Browser control on your form and open the PDF file in the browser - Browser1.Navigate PDFFile$ - works like a charm and you're not tied to a particular version of Acrobat Reader.

He said he wants to select some text and store it into a variable. I assume he means he wants it open to be able to read the data with the code.

To the OP, another point I forgot to make. Text in a PDF might not be text at all. It can also be an image, while Adobe Professional does have OCR recognition, it is not made available by them in their API. You can however extract the image and use an OCR that Office gives you in their library references. I forgot the name of it, but it should be easy enough to Google.

Probably the easiest way to do what you want is to use a Browser control on your form and open the PDF file in the browser - Browser1.Navigate PDFFile$ - works like a charm and you're not tied to a particular version of Acrobat Reader.

Thanks that helped in selecting the required text.
But still im not able to put it in a variable or access the text via code.

You know how to do that?

You know how to do that?

You can't in any way other than the documentation that I provided. This is Adobe's documentation telling you how to access the data. Now... if you want to open it in a web browser object, then you can, you just have to perform your javascript on the browser object rather than an object you defined.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.