Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Fpdf
slaug
post 1.09.2004, 00:19:57
Post #1





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 2.05.2003
Skąd: Gdańsk

Ostrzeżenie: (0%)
-----


Po kliknięciu na link tworzę za pomocą pliku skrypt.php dokument PDF. I wszystko się robi. Co mam jednak zrobić, aby nie tworzył mi go w oknie przeglądarki, a pojawiało się okienko z wyborem opcji: zapisz, otwórz, anuluj.

Z góry dzięki za pomoc.

pozdrawiam,
Daniel


--------------------
Never underestimate the power of human stupidity!
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 2)
rogrog
post 1.09.2004, 08:11:10
Post #2





Grupa: Zarejestrowani
Postów: 602
Pomógł: 1
Dołączył: 3.04.2004
Skąd: Trójmiasto (Gdańsk)

Ostrzeżenie: (0%)
-----


  1. <?php
  2. header('Content-Type: application/octet-stream');
  3. header('Content-Disposition: attachment; filename=nazwapliku.pdf');
  4. header('Content-Type: application/force-download');
  5. //w tym miejscu wysyłanie pliku do przeglądarki
  6. ?>


--------------------
Go to the top of the page
+Quote Post
slaug
post 1.09.2004, 18:35:05
Post #3





Grupa: Zarejestrowani
Postów: 92
Pomógł: 0
Dołączył: 2.05.2003
Skąd: Gdańsk

Ostrzeżenie: (0%)
-----


Dzięki za odpowiedź.

Później doczytałem manuala FPDF, z którego korzystam a tam oczywiście łatwiutko to zrobić, wystarczy wywołać funkcję output z parametrami nazwa i date:

Kod
$pdf->Output('nazwa.pdf', 'D');


Cytat
string Output([string name [, string dest]])

Description
Send the document to a given destination: string, local file or browser. In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.
The method first calls Close() if necessary to terminate the document.
Parameters
name
The name of the file. If not given, the document will be sent to the browser (destination I) with the name doc.pdf.
dest
Destination where to send the document. It can take one of the following values:
I: send the file inline to the browser. The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.
D: send to the browser and force a file download with the name given by name.
F: save to a local file with the name given by name.
S: return the document as a string. name is ignored.
If the parameter is not specified but a name is given, destination is F. If no parameter is specified at all, destination is I.

Note: for compatibility with previous versions, a boolean value is also accepted (false for F and true for D).


pozdrawiam i jeszcze raz dziękuje za odpowiedź,
Daniel

Ten post edytował slaug 1.09.2004, 18:35:53


--------------------
Never underestimate the power of human stupidity!
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 23.06.2025 - 09:19