Page 1 of 2
open pdf
Posted: Tue Mar 22, 2005 4:21 am
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
Posted: Tue Mar 22, 2005 4:31 am
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.
Posted: Tue Mar 22, 2005 4:49 am
by saumya
can you give me the code please?

Posted: Tue Mar 22, 2005 5:00 am
by n00b Saibot
Use
fread. Go Ahead, Read the manual. it has the examples enough for you to get it.
Posted: Tue Mar 22, 2005 5:10 am
by saumya
that will read a file.but I want to open the pdf document as is in adobe acrobat?!!
Posted: Tue Mar 22, 2005 5:21 am
by n00b Saibot
saumya wrote:but I want to open the pdf document as is in adobe acrobat?!!

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

Posted: Tue Mar 22, 2005 5:25 am
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
Posted: Tue Mar 22, 2005 5:27 am
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

Posted: Tue Mar 22, 2005 6:01 am
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");
?>
Posted: Tue Mar 22, 2005 6:10 am
by Pyrite
Short Version: php cannot read/open PDF files. sorry.
Posted: Tue Mar 22, 2005 6:18 am
by saumya
ohhhh
so i can not, finally

Posted: Tue Mar 22, 2005 9:00 am
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.
Posted: Tue Mar 22, 2005 10:25 pm
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
Posted: Tue Mar 22, 2005 10:31 pm
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.
Posted: Tue Mar 22, 2005 10:49 pm
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