hjkl Posted June 1, 2014 Report Share Posted June 1, 2014 Ko darat, ja vajag browserī parādīt uz servera saglabātu pdf failu? Sūtīt uz kādām external API nevar. Object, embed, kaut kas no JS? Kāpēc tieši tā? Quote Link to comment Share on other sites More sharing options...
jurchiks Posted June 1, 2014 Report Share Posted June 1, 2014 (edited) 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 June 1, 2014 by jurchiks Quote Link to comment Share on other sites More sharing options...
hjkl Posted June 1, 2014 Author Report Share Posted June 1, 2014 pdf.js ? https://github.com/mozilla/pdf.js/ pdfobject ? http://pdfobject.com/instructions.php Lietot kaut ko no tā vai paļauties, ka userim jau browserī ir kāds plugins? Quote Link to comment Share on other sites More sharing options...
jurchiks Posted June 1, 2014 Report Share Posted June 1, 2014 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. Quote Link to comment Share on other sites More sharing options...
aaxc Posted June 2, 2014 Report Share Posted June 2, 2014 http://wkhtmltopdf.org/ Quote Link to comment Share on other sites More sharing options...
jurchiks Posted June 2, 2014 Report Share Posted June 2, 2014 Tas tak pilnīgi nav par tēmu... Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.