PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > comp.lang.php > Problem using FPDF
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Problem using FPDF

Réponse
 
LinkBack Outils de la discussion
Vieux 07/11/2007, 13h22   #1
cappieins@t-online.de
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Problem using FPDF

Hi,

i've got a problem using PHP FPDF library to create PDF files send
inline to
a browser window.

The created PDF file opens correctly in the browser (IE 6), but if I
want to save
it to my local disk, there is not automatically the filename used I
passed
to the "Output" function of the lib.

Instead the name of the html page is proposed in the file chooser.

Does anyone have an idea how to get the correct filename automatically
in teh file chooser dialog?

Thanks in advance,
Carsten

  Réponse avec citation
Vieux 07/11/2007, 15h14   #2
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF


<cappieins@t-online.de> wrote in message
news:1194438127.438736.243150@50g2000hsm.googlegro ups.com...
> Hi,
>
> i've got a problem using PHP FPDF library to create PDF files send
> inline to
> a browser window.
>
> The created PDF file opens correctly in the browser (IE 6), but if I
> want to save
> it to my local disk, there is not automatically the filename used I
> passed
> to the "Output" function of the lib.
>
> Instead the name of the html page is proposed in the file chooser.
>
> Does anyone have an idea how to get the correct filename automatically
> in teh file chooser dialog?


what fpdf version are you using? whatever the case, just look a the output
function and check what headers it's sending out. check to make sure there
is header line for:

header('content-disposition: attachment; filename="' . $name . '"');

and that $name (or whatever variable name is used for the file name param)
is set...you also need to make sure you are passing 'D' as the $dest
(destination) param.

hth,

me


  Réponse avec citation
Vieux 07/11/2007, 16h03   #3
Tompkins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF

Hi,

i'm using fpdf version 1.53, but passing an "I" for "inline" as
destination, because I want the browser to open the pdf directly using
the browser plugin. If I use "D", there appears a dialog asking me to
save or to open the file. But thst's not what I want to have...

The header is set corectly for "D" as you wrote, and for "I" it is

header('Content-disposition: attachment; filename="'.$name.'"');

Any further idea?

Thanks,
Carsten


  Réponse avec citation
Vieux 07/11/2007, 16h05   #4
Tompkins
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF

Hi,

i'm using fpdf version 1.53, but passing an "I" for "inline" as
destination, because I want the browser to open the pdf directly
using
the browser plugin. If I use "D", there appears a dialog asking me to
save or to open the file. But thst's not what I want to have...


The header is set corectly for "D" as you wrote, and for "I" it is


header('Content-disposition: inline; filename="'.$name.'"');


Any further idea?


Thanks,
Carsten



  Réponse avec citation
Vieux 07/11/2007, 17h39   #5
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF


"Tompkins" <cappieins@t-online.de> wrote in message
news:1194447820.498426.198680@d55g2000hsg.googlegr oups.com...
> Hi,
>
> i'm using fpdf version 1.53, but passing an "I" for "inline" as
> destination, because I want the browser to open the pdf directly using
> the browser plugin. If I use "D", there appears a dialog asking me to
> save or to open the file. But thst's not what I want to have...
>
> The header is set corectly for "D" as you wrote, and for "I" it is
>
> header('Content-disposition: attachment; filename="'.$name.'"');
>
> Any further idea?


well, for starters, don't switch thoughts mid-stream!

"but if I want to save it to my local disk, there is not automatically the
filename used I passed"

and then:

"because I want the browser to open the pdf directly using the browser
plugin."

stick with telling us EXACTLY what you are having problems with, and maybe
we can you.


  Réponse avec citation
Vieux 07/11/2007, 17h48   #6
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF


"Steve" <no.one@example.com> wrote in message
news:XSlYi.25$rk.2@newsfe05.lga...
>
> "Tompkins" <cappieins@t-online.de> wrote in message
> news:1194447820.498426.198680@d55g2000hsg.googlegr oups.com...


ok, i re-read your hodge-podge op. what you're saying is that:

=====

i want to display a pdf directly in the browser, and when i use the
*browser's* file->"save as" menu option, the browser gives the default file
name as the name of the url/web-page rather than the file name i specified
in the header.

=====

if that is the case, there is nothing you can do to be consistent across all
browsers. headers are "directives", not "commands". the browser treats them
like *suggestions* and nothing more. this has nothing to do with fpdf.

to test it, put an already created pdf in your web root, use a browser to
pull it up via its url...then file->'save as'. notice, url...not file name.


  Réponse avec citation
Vieux 07/11/2007, 19h25   #7
Carsten Wesch
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF

The test case you describe is exactly what I did, and it works properly.

I tested it with a PDF document that was created using fpdf, so I don't
understand wht's the reason for this behavior.

Thanks,
Carsten


  Réponse avec citation
Vieux 07/11/2007, 22h42   #8
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF


"Carsten Wesch" <cappieins@t-online.de> wrote in message
news:fgsvug$9k2$03$1@news.t-online.com...
> The test case you describe is exactly what I did, and it works properly.
>
> I tested it with a PDF document that was created using fpdf, so I don't
> understand wht's the reason for this behavior.


well then, you've got me stumped. i had different test results. have you
echo'ed out $name and then exited immediately so you could see the value of
$name?


  Réponse avec citation
Vieux 07/11/2007, 22h46   #9
Steve
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Problem using FPDF

"Carsten Wesch" <cappieins@t-online.de> wrote in message
news:fgsvug$9k2$03$1@news.t-online.com...
> The test case you describe is exactly what I did, and it works properly.
>
> I tested it with a PDF document that was created using fpdf, so I don't
> understand wht's the reason for this behavior.


actually, i didn't describe fully what the test should be. your uri to the
document *IS* some.file.pdf...so your browser will want to save it as the
same. if, however, you made a script called some.file.php, and in it put:

<?
header('content-disposition: attachment; filename=some.file.pdf');
echo file_get_contents('some.file.pdf');
?>

your browser would STILL want to save it as some.file.php...which is the uri
resource name. see the difference?


  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 16h55.


Édité par : vBulletin® version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,13224 seconds with 17 queries