I was wondering if anyone knows of any way to take the HTML content of a custom module which is placed inside an article and convert the HTML to PDF via the click of a button or so.

So basically the user will have a button "convert to PDF", and the PDF file will be generated with the HTML content, and they will have the option of downloading it.


I suggest using Phoca PDF. It's a decent extension. https://www.phoca.cz/phocapdf

  • I have tried that one, but it was not working. I have a custom template so it may have performed and override on some content files. However, I've used jsPDF and jspdf-AutoTable to sort the issue :)
    – MailBlade
    May 19 '18 at 6:38

I would advice you to use Aspose.PDF Cloud SDK for PHP to create PDF from HTML. Here is a quick example:

use Aspose\PDF\PdfApi;
use Aspose\PDF\AsposeApp;

// Initialize API
public $pdfApi = new PdfApi();

// Upload file to Aspose Cloud Storage
$fileName = "output.pdf";
$templateFile = "input.html";

// Convert file to HTML format
$result = $this->pdfApi->PutCreateDocument($fileName, $templateFile, $dataFile = null, $templateType = "html", $storage = "", $folder = "");

Note: I am working as Developer Evangelist at Aspose.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.