how to disable save option for fpdf generated files in php? - php

i am using fpdf to generate reports in php. I don't want users to save the generated pdfs. They will only print the documents.How can i do it?Any help will be appreciated.

Pretty sure as long as this is sent to the client's browser from the server to display the pdf there is honestly nothing you can really do to prevent a user from "saving" it, they'll find a way.

Trying to prevent users from saving the PDF is the same as trying to prevent users from creating screenshots, they always find a work around. Also to be able to print PDF, the PDF has to be stored in the users cache to send it to their printer. Also some browsers cannot show the PDF with the option to print it, they have to download the PDF to open it in ie Adobe Reader to print it from there.

I would like to suggest not to create PDF for this, otherwise if PDF will be opened at browser that can be easily saved or copied. If you allow users to download it then make a copy of report in PDF and let client download it.

Related

I want to convert ppt files to pdf in php?

actually i have to display ppt file in browser but it gives download option instead of displaying.so im using it to convert in pdf format so that browser display it and restrict user to download
why don't you use Google Docs or HTML5 presentation systems
Read more here
http://www.sitepoint.com/5-free-html5-presentation-systems/
you may alternatively try saving the ppt as image by File - Save as - Save as type and show the image in your browser.
NB: You can't restrict the user from downloading. Alternatively, you can show images to registered users.
You can restrict users from downloading if you will use flash player with external datasource like non-cacheable stream video. PDF and images can be freely downloaded even if you put it in "iframe", block the "mouseclick" and "drag-and-drop" events. By the way, if you can see it in a browser, then you already have copy of it in the system cache.
Sorry.

Chrome - Save to PDF function use in a website

Chrome allows users to hit Ctrl + P and choose 'Save to PDF'.
Is it possible to have this function through an html button?
I want the user to just hit a button and go directly to the Save as PDF prompt ( where the file name is set by PHP and not automatically by Chrome ). So the user basically just hits the button and clicks on Save on the prompt window.
Is this possible?
Can I skip the previous steps?
Nope, it's not possible.
But, you can give the user the choice to download a HTML file output as a PDF file. There are a few libraries around, Prince is the best but expensive, so check out DOMPDF.
By the time your user can hit ctrl+P in the browse, the PHP process that generated the page (on server) is already closed.
Besides the fact that PHP exerts no direct control over browsers. It just sends them information in the form of HTML/CSS and important in this case JavaScript.
With JavaScript you could trigger the normal print behaviour of the browser but you would have no control over it.
Another approach could be to generate the PDF on server and send it as a file to the browser. In which case the browser will either ask the user if he wants to open it or it will ask the user if he wants to download it.
I've personally used fPDF to customise the PDF invoices of various open source e-commerce software. Like for example PrestaShop.
All you really need to do is download the library from (fPDF](http://www.fpdf.org/), but seeing it in action and being able to change/adapt a working version might help you so you could look for the PDF invoice in a fresh the PrestaShop install inside the folder classes the file name is PDF.php .
I lost several hours trying to make conversion to pdf on the server with no luck because my view contains some jquery functions that do the main rendering. I thought of providing a button to save as pdf using the browser but then opted to using javascript on the client side to do the rendering to pdf. This may not be the optimal solution in certain cases but looked the most sensible one in my case.
there are many libraries I just started using html2pdf.js and it is working fine so far.

Allow user to save a html/php/css page as a pdf?

I have a "calculator" page that calculates a load of maths based on what the user inputs. The user can then click "get results" to show their full calculations.
I then have a button - "save as pdf" which I want it to allow the user to save a pdf of their results.
It's a combination of html, php, css combined with Wordpress.
How can I (on click) convert the results to a pdf and allow the user to save?
p.s I know this been asked a few times but I can't seem to find the correct answer or a working version... or a tool with good documentation for me to follow!
Check also FPDF
Generally these things are solved on the server. Clicking the link would trigger a redirect to the php page and in general instead of writing output to a webpage, you write output to a pdf stream (still arrives in the browser but the browser knows it as a pdf).
you do this by changing the response headers. you could use this library to write out the pdf file
http://code.google.com/p/wkhtmltopdf/ make sis pretty simple, you could do a curl request to the page, and send it to the library.

Is it possible to make pdf files content readable but uneditable and secure

Normally, pdf files can be edited by applications like Adobe Acrobat Writer. And when we open the pdf files in applications like adobe acrobat reader, we can select the contents. I need the codes that can create the pdf file and make it's content uneditable and users can't select the contents.
Please help me out with this.
You can render text and overlay an image. I am not sure whether this will work - viewer applications may allow the text to be selected.
If you render the text as watermark annotations, then that content will not be selectable.
You could encrypt the document and set an empty string as the user password but a full string as the owner password document. This will allow anyone to open the document without entering a password. To prevent content selection, you need to specify deny "content selection" user permission.
Our company Gnostice has PDF components for Java, .NET, and Delphi/C++Builder platforms. All of them can render text and images, create watermark annotations, encrypt PDF document, and also specify usage permissions.
you can use pdf password secure http://luxsci.com/blog/how-secure-are-password-protected-files.html.
On development enviroment using php, i have no idea how to implement it, but it helps... i guess if you convert all your text to image, they never could copy that.
Use this link to know about creating a PDF file using PHP dynamically. http://www.devarticles.com/c/a/PHP/Use-PHP-to-Create-Dynamic-pdf-Files/ In the properties, you can make it read-only.
Save the PDF file as an image. Then create a PDF of that image. If the PDF is multiple pages, you may want to consider saving it in a multi-page image format such as a tiff. Otherwise you will end up with 1 image per page if using say, the jpeg format and then have to combine them into one PDF Document. I do this with Services Agreements all the time.

how to display PDF in a php site?

I am new to codeigniter, and not so new to PHP. I am developing a site that has a login for 2 users and once they login, it'll show an optin to view an invoice. I am not making the invoice since I have a stack of invoices already. I want to do it so that once they click on view invoice they can see a PDF. I have searched but I ask you for some idea in the visualization of PDF in codeigniter?
I'm guessing that you want to generate pdfs. There is a library called dompdf that lets you do it quite easily and there is documentation on using that with Codeigniter.
If you're wondering how to link between a pdf and a customer, I'd suggest adding a field in the database to match each customer or perhaps a whole table depending on your use case.
Not sure if I understand your question but here goes...
If you just want to marshal an existing PDF file via PHP, its basically a case of
Send the appropriate "Content-Type" response headers for a PDF file, eg application/pdf
Deliver the file contents using something like readfile()
From my understanding, you have a directory of PDFs that need to be displayed to the user.
This is usually handled by the PDF software. Adobe Reader can render the PDF in the browser and so can newer releases of the Chromium which have PDF viewing built in.
Make sure you send the correct response headers as Phil Brown points out and you're all set.

Categories