Jump to content
php.lv forumi

pdf browserī


hjkl

Recommended Posts


if ($download)

{

    $contentType = 'application/pdf';

    $contentDisposition = 'attachment';

}

else

{

    $contentType = 'application/octet-stream';

    $contentDisposition = 'inline';

}

 

header('Content-Type: ' . $contentType);

header('Content-Disposition: ' . $contentDisposition . '; filename="name.pdf"'); // šis nosaukums tiks piedāvāts, kad lietotājs mēģinās saglabāt failu uz sava datora

readfile('/path/to/file/name.pdf'); // lai izvairītos no problēmām ar atmiņu, pirms šīs darbības izslēdz output buffering, ja tas ir ieslēgts

 

Edited by jurchiks
Link to comment
Share on other sites

Normāliem pārlūkiem pdf plagins nāk defaultā. Veciem pārlūkiem lietotāji ir pieraduši saglabāt PDFus uz diska un atvērt pēc tam, tas pats ar lietotājiem, kuri to plaginu izslēguši manuāli.

I don't see the need for this, even though pdf.js looks cool.

Basically, your choice.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...