open pdf

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

saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

open pdf

Post by saumya »

i am very new to this world.
how can a I open a pdf file from php?any suggestions will be appreciated.
thank you
saumya
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

PDF's are binary files that can be opened by using file functions but don't expect to get any information outta that ;)
In PHP, you can write a PDF file using PDFlib, CPDF, FPDF etc. but you can read in one.
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

can you give me the code please?
:idea:
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Use fread. Go Ahead, Read the manual. it has the examples enough for you to get it.
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

that will read a file.but I want to open the pdf document as is in adobe acrobat?!!
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

saumya wrote:but I want to open the pdf document as is in adobe acrobat?!!
8O
i have already told you that...
I wrote:PDF's are binary files that can be opened by using file functions but don't expect to get any information outta that
Why don't you understand that. isn't acrobat doing its job jus' fine :?
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

i am sorry.i could not get you.i am not trying to irritate you but i am not that savvy as you so forgive me if i am asking?if you explain me it will be better,i just can not open a file in acrobat?
saumya
User avatar
n00b Saibot
DevNet Resident
Posts: 1452
Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:

Post by n00b Saibot »

Ok. lets see. you cannot open the file in the acrobat. does that mean acrobat is not installed on your system or that acrobat is not opening it :?:
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

it says

Warning: fopen() expects at least 2 parameters, 1 given in D:\Saumya\PHP\pdf.php on line 2

my code is

Code: Select all

<?php
fopen("budget_book_2005-06.pdf");
?>
User avatar
Pyrite
Forum Regular
Posts: 769
Joined: Tue Sep 23, 2003 11:07 pm
Location: The Republic of Texas
Contact:

Post by Pyrite »

Short Version: php cannot read/open PDF files. sorry.
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

ohhhh
so i can not, finally :cry:
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

what do you want to do with the PDF ? PHP has a few extensions to work with them, but not much more. If you want to open it in the browser, sending it as inline to the browser is the easiest way. You need to supply a link to download a new reader as well, just in case they don't have Acrobat Reader.
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

well,actually i just wanted to open a pdf file, which is there in the server somewhere in a folder.i know the relative path of the folder.what i want is depending upon the user clicking a button a separated pdf document should open in acrobat.Actually i want to make a cd and it consists alot of pdfs.i want to open them from one html page.can i use php here, in this case?
thank you very much for your concern and answering nicely.
saumya
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

you can use php to generate the html index page, yes... inlining a pdf is more difficult with solo html, it'll run off whatever the default action for their browser to do with them.
saumya
Forum Contributor
Posts: 193
Joined: Sun Jan 30, 2005 10:21 pm

Post by saumya »

so, what do you suggest me to do?how can i open a pdf document.or its not possible as Pyrite has said earlier.
thank you verymuch.this kind of responses make me to come to this board again and again.thank you feyd.
i was reading through your poast in improving the php support in this board and how we can leverage the power of the codes to post.really nice work done.congrats.i come across a doubt,what is a bbcode?
saumya
Post Reply