How to read pdf document & display its content in browser??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
nmreddy
Forum Commoner
Posts: 25
Joined: Wed Feb 18, 2009 5:36 am

How to read pdf document & display its content in browser??

Post by nmreddy »

Hi ,

In my application a user will upload pdf documents , i have to read that pdf file and display the content in the pdf to the browser .
how can i do that
can any one suggest me the solution ??

Thanks,
Maheedhar
nmreddy
Forum Commoner
Posts: 25
Joined: Wed Feb 18, 2009 5:36 am

Re: How to read pdf document & display its content in browse

Post by nmreddy »

Can any one have a solutions??
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: How to read pdf document & display its content in browse

Post by mikosiko »

browsers normally have pdf plugins installed (or you can install it) to display pdf's files directly... no much to "invent" here
xtiano77
Forum Commoner
Posts: 72
Joined: Tue Sep 22, 2009 10:53 am
Location: Texas

Re: How to read pdf document & display its content in browse

Post by xtiano77 »

I normally use a tag like the one below to ensure that the file opens in a separate window.

<a href="yourfile.pdf" target="_blank">Your File</a>

If you want to view the file in the same window where the link is just changed the "target" property to "_top". You can always use the "open( )" JavaScript function which will normally open the file on its own window. Just my two cents.
nmreddy
Forum Commoner
Posts: 25
Joined: Wed Feb 18, 2009 5:36 am

Re: How to read pdf document & display its content in browse

Post by nmreddy »

First Thanks for the suggestions,
but what i want is , when a user upload the pdf file i have to read the contents of pdf and display its contents in the webpage like we read text files and display its contents..
cpetercarter
Forum Contributor
Posts: 474
Joined: Sat Jul 25, 2009 2:00 am

Re: How to read pdf document & display its content in browse

Post by cpetercarter »

It is not easy to do what you want. There are several php/pdf libraries (eg FPDF) but they all create pdf documents using php - they don't read pdf documents and turn them into html which you can then send to the browser as part of a web page. This post suggests one way of reading a pdf file into a php variable, but you need root access to your server to do it. This post explains a more practical approach to reading the "clean text" from a pdf document, which may do most of what you need.
brishable
Forum Newbie
Posts: 1
Joined: Tue May 11, 2010 2:06 pm

php is not working on wamp

Post by brishable »

0 vote down star


i have installed wamp server but php is not working.
i wrote a simple php code to display something on a browser
and stored it on c:\wamp\www\bre nothing is displayed on the browser.
i have tested the c:\wamp\index.php file but the browser starts downloading it instead of
opening the page.
and i have tested to connect html forms with the mysql database and still the
php part don't do anything. my operating system is xp.
i'm really worried can anybody help me?
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: How to read pdf document & display its content in browse

Post by mikosiko »

brishable wrote:0 vote down star


i have installed wamp server but php is not working.
i wrote a simple php code to display something on a browser
and stored it on c:\wamp\www\bre nothing is displayed on the browser.
i have tested the c:\wamp\index.php file but the browser starts downloading it instead of
opening the page.
and i have tested to connect html forms with the mysql database and still the
php part don't do anything. my operating system is xp.
i'm really worried can anybody help me?
and why are you posting a new issue in somebody else thread?... that it is not polite/good etiquette ... please read the forum rules and how to post your how thread.
nmreddy
Forum Commoner
Posts: 25
Joined: Wed Feb 18, 2009 5:36 am

Re: How to read pdf document & display its content in browse

Post by nmreddy »

@cpetercarter -- thanks for the valuable suggestions , presently i am getting the text but it was like a one string

ex:this would be giving as thiswouldbe
Post Reply