Create labels on pdf - php

i want to open PDF file in a iframe OR windows Extjs
and let user click to add labels
what scripts can i use ?
im coding with Extjs / php /mysql
i use fpdf/fpdfi libraries to write on a PDF file
any idea ? help please
thank

Simply pointing iframe to PDF file only works when user has allowed it's web browser to embed Adobe Reader (I'm not even sure that other PDF-readers support this at all). This might be the common configuration for IE users, but in other browsers and especially on other OS-es it's not as common.
Another option is to use a service that renders your PDF as web page. For example using google docs it's dead easy:
<iframe
src="http://docs.google.com/gview?url=http://yourdomain.com/file.pdf&embedded=true"
style="width:600px; height:500px;"></iframe>

Related

How to display(not download) files on a webpage in php?

I am showing a list of files on a webpage. Files may be of any type like pdf,doc,excel,txt etc.
What i want is when some one click on an item of the list then that file should be displayed in another tab. I dont want to download the file. I just want them to be visible so that user can read it.
I try this using php for pdf files i am able to get the plain content of the file but i want a viewer type of thing.
Can i achieve this?
If yes can i achieve this in php?
If yes then how?
Thanks and Regards
Sumit Rathore
downloading or viewing any file in browser depends on browser setting.
for example in firefox in Options - > Applications Tab you can change state of reading a file that can be downloading or viewing.
now, for display a file to visitor best solution is creating a special php or flash app.
Good Luck.
see http://view.samurajdata.se/
<html>
<body>
<embed src="www.dedoimedo.com-apache-web-server-lm.pdf">
</body>
</html>
This code is working in google chrome but not in other browsers.

View PDF in browser without Download (Something like gmail attachment)

We are using php to generate PDF on server.
Can you please help me to understand, how to give facility to user to view PDF online (something like feature of Gmail) ?
Any reference document will be of great help.
In this figure, if I click on PDF icon / anywhere outside two buttons to download / recycle ; I can view pdf with lighbox effect in the background.
If I click on Download , pdf get's downloaded on the client machine.
Is there any way to achieve similar effect?

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.

php: read an http url and write it to pdf

im using php
I want to read a url ex http://www.cnn.com
create a new pdf and store to the server
Try this: http://code.google.com/p/wkhtmltopdf/. It's open source, and seems to be based on the WebKit engine, which is used in many browsers today (Chrome, Safari, iOS, Android). It also has PHP bindings!
Here's the link to the GitHub page: https://github.com/mreiferson/php-wkhtmltox.
You can't just create a pdf from a web page. Especially if you don't want to make a jpeg of the whole thing and stuff that in a pdf.

Display PDF file in modal window

Is there any way I can direct display PDF files in modal boxes?
I am using CodeIgniter PHP framework and jQuery as JavaScript framework.
UPDATE: I read on net that this is possible by loading it in iframe, and Adobe PDF will render it, but many seems to oppose, so is there any way I can convert those PDFs to images?
Short answer: No.
Longer answer: Usually, PDF documents are not rendered by the browser directly, but rather by some specialized PDF reader. As soon as the browser sees a content type of application/pdf, it passes the response along to the reader. Nothing you would do in your HTTP headers, HTML or JavaScript would make it across the gap between the browser and that other program, and the PDF format itself contains no switch to enable any kind of modal user interface.
Update: Rendering the PDF as an image would allow you to display the graphical content of the document in a more modal fashion. You still are not able to block the user from closing the browser, but you would be able to "lock down" anything else on your page while the image is displayed.
Related: How do I convert a PDF document to a preview image in PHP?
If you really want to, you can just embed it as a normal object. For example:
<object type="application/pdf" data="embeddedfile.pdf" width="500" height="650">
That's a bad idea. Always let the user set their browser to how they want to handle PDF files. So just create a link to the pdf. Modal windows aren't for that purpose anyway.

Categories