html to pdf viewer like lightbox? - php

Is there any way to generate a pdf view from html , just like we use light box to see images?
In simple words, i have a WYSIWYG editor and a button, all i want is that, after clicking on a button there should be a function which should convert html from editor and provide pop up having view in pdf format.

I guess you can just send your html back to the server (maybe in ajax), and convert the html to pdf using something like TCPDF to convert html to pdf in php.

Related

TCPDF - How to save PDF to server including form values?

So I'm using TCPDF to generate a PDF with multiple Text Areas in a form. On Submit I want to save this PDF including the newly added Text on my Server but I can't find a way to do it.
I'm using a form like this:
https://tcpdf.org/examples/example_054/
If I change the Output to F I just save the blank PDF to my server.
Any hint what I miss? Have the feeling it's just a simple setting thing.

How to render HTML and graphics on top of existing PDF using wkhtmltopdf

I have these inputs:
an HTML page
an Existing PDF, and some more HTML/stuff I want to draw on top of that PDF (text, html, circles)
an HTML Page
I want to render a 3-page PDF, and have them all be displayed on in a single PDF.
In other words, my question is How do I use an existing PDF as a template for more input
Can this be done from PHP and how?
Unfortunately, with wkhtmltopdf, you can't modify/edit an existing PDF.
With a custom XSL using this code, you could easily do it.
http://www.cloudformatter.com/CSS2Pdf.APIDoc.Usage
The backend rendering engine is XSL FO based which supports injecting a PDF as a background image.
So easy, I did you a sample. Go to this page:
http://www.cloudformatter.com/CSS2Pdf.CustomTipsTricks.BackgroundImages
Click the Open-> PDF button.
The "Top Secret" PDF is injected as a background, the HTML overlayed on top. You can use this solution to combine your HTML, PDF and HTML+PDF in any way you wish.
In fact, with HTML, this Javascript and a little customization you could have a document that was:
start document
format HTML div
format HTML div with this PDF background
format another HTML div
inject this entire PDF
format another HTML div with a different PDF background
inject a different entire PDF
...
end document

To Copy the Selected text in Pdf which is inside an Iframe without using copy, paste

How to copy the selected text from a pdf which is inside an iframe using double click or any event.
This is my application If i double click on a word it should be copied in the text field on the rightside,
Actually i have done it on a text File But For Pdf i couldnt do it. Any Idea or help will be appreciated,Thanks in advance.
The adobe documentation says there's no way for JavaScript in the browser to access the PDF.
Acrobat JavaScript does not have access to objects within an HTML
page. Similarly, HTML JavaScript cannot access objects within a PDF
file.
http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/javascript/AcroJSGuide.pdf
What you could try is rendering the pdf itself in JavaScript using a library like pdf.js. Once the pdf is part of the dom, you could attach a listener in a similar fashion to what you've done for the text documents.

MathJax html render to pdf

I am trying to make an online quiz application where the user will be presented with a quiz that contains text, images and math equations. I also want the user to be able to print that quiz. I am using MathJax to display the equations.
If the quiz contains just text and images but no math equations, I can use DomPdf to convert the quiz HTML to a PDF and have the user print it.
However, how can I go about creating a PDF that has both the content from the HTML tags in the quiz and the math equations from the quiz rendered by MathJax?
According to this post: http://sourceforge.net/projects/mathjax/forums/forum/948700/topic/3819537
wkhtmltopdf can convert the mathjax if you force a delay on the javascript rendering. I just got finished talking to a guy here:
Printing the current page to pdf using wkhtmltopdf
about how to get a page saved to pdf using wkhtmltopdf from php. If you put those two things together, I think you can get what you want.

How to save a page as pdf in php

Does anyone know how I can save a page as pdf in php?
Example:
I have a page that is able to catch the users signature. Now I would like to create a button on the page that will convert the page into pdf so that the file can be saved to a folder.
Below you can see what the signature page looks like:
There are a number of PHP PDF API and tools which convert or wrap up html content including drawings, links and images etc.
A very good thread from StackOverflow :
Convert HTML to PDF using PHP
TCPDF can output PDF's from html: http://www.tcpdf.org/
If you need to use more advanced html you can use WKHTMLTOPDF: http://wkhtmltopdf.org/

Categories