codeigniter render html to image - javascript

I have a page that needs to be printed to a 'A4' content. So I've tried to use the mPDF library. In that page, I have a calendar content. At first I used CI's Calendar, and when I rendered it to mPDF it works perfectly. But I recently changed the calendar to a jquery calendar due to user's specification. So I changed it using FullCalendar.
When I passed it to mPDF, it displayed my other content in that page, but the javascript for the FullCalendar didn't appear in the PDF.
I was thinking to change my output to an image. Is there any tools (meaning libraries) to change my output to image and display it in the browser?
Note : There is javascript and css in my page, which I've read that most pdf generating tools can't render either javascript or css, or both.

You might try using canvas to create an image of the screen and then sending it to your PDF creator. I realize this isn't a full fledged answer, but it's something I'm looking into for a similar purpose. This question has some more details.

Related

Display a PDF inside a frame created within another PDF using JavaScript in Adobe Acrobat

I want to display the selected pages of a PDF(existing in local machine) inside a window/frame of another PDF file(existing in local machine) in ADOBE Acrobat. How can i go about it . I searched online but i seem to not find any solution . If there is any other way to do this without using java script, is acceptable too.
You may have missed the keywords…
What is pretty common and easy to implement is importing the according page as an icon in a Button field.
The simplest approach would be using the buttonImportIcon() Acrobat JavaScript method (note the requirements for higher privileges). This method allows you to specify the file and the page to be imported.
If you're only doing this when you're authoring the PDF and it doesn't need to be dynamically created, you can simply add a button field and then set the icon property to the PDF you want to show. If you need to do it programmatically, Max's answer will also work.

How to create pdf export of a part of the current page on the client side

I try to understand if I could use PhantomJS (or any similar js library) in my web application (in a javascript function called when "ExportToPdf button is hit) to create pdf export of a part of the user's current page, for example the contents of a div, but with its current styles.
And I need it to be made on client side.
I see over my searches that phantomJS is used as a tool (console app executable), but could I utilize it the way I need it?
Maybe in combination with jsPDF or some similar js library...
Or if you have any other solution to suggest... I already have tried jsPDF alone and it does not get any styles at all (all bootstrap class elements are missing). Also I tried html2canvas+jsPDF to get image of the desired div contents and put it on a pdf doc, but this does not seem to get all the height of the div (only the part that is viewable in browser gets exported)

Generate PDF of a section of a php page once rendered into HTML and CSS and account for pdf page-breaks

The system I am working on has a questionnaire in it and then shows the responses to the admin in a nice report on screen. I need to create functionality that turns the on screen report into a pdf, similar to how the browser generates a pdf of the page when you select print. Although I need to only turn a section of the page into pdf. And it would be ideal to be able to alter the HTML so that the pdf page breaks don't interfere with the presentation of the report.
You can download a pdf of how the report looks, generated by the browser functionality. This is just an example, I need the pdf to be generated by a link or button and not include the whole page (the top part in this case).
I have tried some php HTML to pdf generators, but it's difficult because the HTML is dynamically generated so I'm not sure how to send all the HTML, once rendered, to the page that creates the pdf.
To overcome the page breaks, I've considered using javascript or jquery to read the height of the div of each question within the report and then write a simple script to calculate if the next div will fit on the page and if not add a margin on top of that div so that it starts on a new page.
What software can I use to generate the pdf, given these requirements? Either php or javascript. Appreciate the help.
Have you considered Snappy for PHP? It makes use of wkhtmltopdf behind the curtains to convert any HTML document into PDF.
We are using it and it works great.
https://github.com/KnpLabs/snappy
You could try mpdf and use the page-break-inside: avoid property which is actually a CSS property. I have not used this, but it might be what you're looking for.
Looks like you can add this property to the <div> and <table> tags (mPDF Supported CSS).

Include PDF as an image in HTML

When using LaTeX one can include a PDF as an image (this is usually done, e.g., with scientific papers, in which one can include a graph in PDF, so that it can be shown properly at different scales).
By using some tools like remark and MathJax one can create web pages with some LaTeX insertion.
Now, suppose I am interested in including a PDF as an image, as I usually do with plain LaTeX files.
I have tried to include my PDF using the <img> tag, and everything was working, since I realized that this only works in Safari (since Safari considers PDFs as images too). This consequently does not work in other browsers, as Chrome / Firefox.
So, I tried to include the image with an <embed> tag, as shown here. However, what I obtain is a mini-PDF viewer inside the browser, with a grey frame all around the image I am including. I would instead like to include just the image, with no frames.
Is there a way of reproducing this behavior?
Thank you in advance.
I dont know what type of framework or cms you use for your Homepage. But i guess you have to use sth like "imagemagick" to render your pdf files, like its done in wordpress or other cms systems.

Use CKEditor image plugin without the HTML editor

I'd like to use CKEditor's Image plug-in separately from the rest of CKEditor.
Basically I'm creating a simple tool to edit webpages. Some parts of the webpage will be HTML and thus require the full CKEditor. But some parts will be images, and I don't need the full HTML editor, just the Image plug-in.
Is this possible to do, and what would be the "cleanest" way to do so?
CKEditor doesn't provide an image browser by itself, so you must research how to use the file browser component that you have picked by itself.
If you're using CKFinder look at the standalone.html sample, like shown in the "enhancing html forms" here: http://ckfinder.com/demo

Categories