All Projects → Dellos7 → dhtml2pdf

Dellos7 / dhtml2pdf

Licence: other
Simple, free and very easy to use PHP API that allows you to see, download or get the binary of the PDF generated from the HTML of an URL.

Programming Languages

HTML
75241 projects
PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to dhtml2pdf

YetiForcePDF
The best library in the world to generate PDF from HTML
Stars: ✭ 15 (-44.44%)
Mutual labels:  html-converter, html2pdf, pdf-generation
mr-brown
Mr.Brown is a responsive Jekyll theme
Stars: ✭ 21 (-22.22%)
Mutual labels:  simple, free
Chocolater
Chocolater is simply a PowerShell code generator and it was conceived in order to facilitate the selection and installation of your favorite applications in one go.
Stars: ✭ 26 (-3.7%)
Mutual labels:  simple, easy-to-use
Slop
Simple Lightweight Option Parsing - ✨ new contributors welcome ✨
Stars: ✭ 1,067 (+3851.85%)
Mutual labels:  simple, easy-to-use
fresh
Fresh is a free blog template for Jekyll
Stars: ✭ 48 (+77.78%)
Mutual labels:  simple, free
add-to-calendar-button
A convenient JavaScript snippet, which lets you create beautiful buttons, where people can add events to their calendars.
Stars: ✭ 697 (+2481.48%)
Mutual labels:  simple, free
Server Manager
This repository holds the IntISP Interface. It can be rebuilt to interface with any other hosting panel.
Stars: ✭ 31 (+14.81%)
Mutual labels:  simple, free
QArchive
Async C++ Cross-Platform library that modernizes libarchive using Qt5 🚀. Simply extracts 7z 🍔, Tarballs 🎱 and other supported formats by libarchive. ❤️
Stars: ✭ 66 (+144.44%)
Mutual labels:  simple, easy-to-use
Web Presentation
Jekyll theme template to create web presentation
Stars: ✭ 137 (+407.41%)
Mutual labels:  simple, free
Valine
A fast, simple & powerful comment system.
Stars: ✭ 1,899 (+6933.33%)
Mutual labels:  simple, easy-to-use
Flags
⛳ Simple, extensible, header-only C++17 argument parser released into the public domain.
Stars: ✭ 187 (+592.59%)
Mutual labels:  simple, free
Lang-app
Add a multi lang configuration to your WEB APP 'from scratch' [ANY FRAMEWORK, ANY PLUGIN, ANY API]
Stars: ✭ 15 (-44.44%)
Mutual labels:  simple, easy-to-use
WHMCS-Discord-Notifications
A hook to push a range of different WHMCS notifications instantly to a Discord channel.
Stars: ✭ 52 (+92.59%)
Mutual labels:  simple, free
DM-BOT
📧 DM-BOT is discord bot that can record direct messages. One of us! You can also reply to those messages! DM-BOT is easy to use & understand! I decided to use Discord.js, it's literally the best.
Stars: ✭ 31 (+14.81%)
Mutual labels:  simple, easy-to-use
AppImageUpdater
AppImage Updater for Humans built with QML/C++ with Qt5 ❤️.
Stars: ✭ 31 (+14.81%)
Mutual labels:  simple, easy-to-use
Mcdowell Cv
A Nice-looking CV template made into LaTeX
Stars: ✭ 855 (+3066.67%)
Mutual labels:  simple, easy-to-use
wkhtmltopdf-flask-aas
Wkhtmltopdf Flask As a Service
Stars: ✭ 17 (-37.04%)
Mutual labels:  wkhtmltopdf, pdf-generation
magento2-module-pdf
Magento 2 Module for creating PDF's based on wkhtmltopdf
Stars: ✭ 55 (+103.7%)
Mutual labels:  wkhtmltopdf, pdf-generation
Perfectwindows
PerfectWindows 软件家族 - Windows 从未如此完美!
Stars: ✭ 1,326 (+4811.11%)
Mutual labels:  simple, easy-to-use
ytmous
Anonymous Youtube Proxy
Stars: ✭ 60 (+122.22%)
Mutual labels:  simple, easy-to-use

dhtml2pdf

dhtml2pdf is a simple, free and very easy to use PHP API that allows you to see, download or get the binary of the PDF generated from the HTML of an URL.

It uses the snappy image & PDF from URL generation PHP library, which is based in the awesome webkit-based wkhtmltopdf and wkhtmltoimage CLI.

Try it out here! 👉 https://dhtml2pdf.herokuapp.com/

As I'm using the free Heroku containers to host the app, so it sometimes stops working because of the quota limits they have. I've created a second instance of the app (👉https://dhtml2pdf2.herokuapp.com/) which you can use, however I recommend you set up your own private Heroku instance if you plan to frequently use this

The API

Currently, the API is an PHP-based end point which simply allows you to pass as parameter the URL of the HTML page that you want to convert to PDF. It's deployed as a Heroku APP so you can use it whenever you want to.

It's as easy as this:

https://dhtml2pdf.herokuapp.com/api.php?url=<your_url>&result_type=<result_type>

Params:

  • url. The URL of the site you want to convert to PDF. Example: url=https://www.github.com
  • result_type. The way you want to retrieve the generated PDF. Can be one of the following:
    • show. Opens the generated PDF in the browser.
    • download. Downloads the generated PDF.
    • binary. Returns the binary content of the generated PDF.
  • file_name. If you choose download in the result_type parameter, this is the name of the file that will be downloaded (you must pass the name) without the .pdf extension.

Example:

This:

https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=show

would open the generated PDF from the https://www.github.com site in your browser.

Examples

HTML

Anchor to show the PDF in a new browser tab:

<a href="https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=show" target="_blank">Show PDF</a>

Anchor to download the PDF as my_pdf.pdf:

<a href="https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&result_type=download&file_name=my_pdf" target="_blank">Download PDF</a>

PRO TIP: Show or download current page in PDF

<a href="javascript:window.open('https://dhtml2pdf.herokuapp.com/api.php?url='+window.location.href+'&result_type=show', '_blank')" target="_blank">Show PDF</a>

jQuery

Retrieve the binary data of the PDF:

$.ajax({
    type: "GET",
    url: "https://dhtml2pdf.herokuapp.com/api.php?url=https://www.github.com&&result_type=binary",
    success: function(data){
        //Prints the PDF binary data in the browser console
        console.log(data);
    },
    error: function(err) {
        console.log(err);
    }
});

Deploy your own server API

If you don't want to depend on a external service as this one, you can easily clone the repo and deploy it in your own server. I will show how to deploy it in a Heroku server as it's easy and fast to install and free!

Clone the repo:

git clone https://github.com/Dellos7/dhtml2pdf.git
cd dhtml2pdf

If you had any troubles following the below instructions, please visit the Heroku PHP getting started guide at https://devcenter.heroku.com/articles/getting-started-with-php#set-up

Sign up in Heroku: https://signup.heroku.com/

Download & install Heroku CLI: https://devcenter.heroku.com/articles/heroku-cli#download-and-install

Login in the Heroku CLI:

heroku login

Create your Heroku APP:

heroku create <your_app_name>

(your APP name will be deployed then in https://<your_app_name>.herokuapp.com)

Update & create the composer dependencies:

composer update

Remove the current git repository and create a Heroku one:

rm -r .git
git init
git remote add heroku https://git.heroku.com/<your_app_name>.git
git add .
git commit -m "first commit"

We only need a last command in order to push our APP to heroku, which will perform the PHP build and deploy the APP!

git push -u heroku master

Working currently on heroku-16 stack and heroku-18 stack

License

GPL 3.0 License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].