Serverside PDF

Serverside PDF

wkHTMLtoPDF

wkHTML2PDF

Installation auf 1und1/Ionos server with ssh

  1. Connect via SSH to the server (https://www.ionos.de/hilfe/index.php?id=2923)

  2. Download the correct version (in my case):

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_amd64.deb
  1. Execute the following statements:
ar vx wkhtmltox_0.12.6-1.buster_amd64.deb

which should result in the following folders/files:

debian-binary
control.tar.gz
data.tar.xz
  1. Execute:
tar xf data.tar.xz
  1. Check if everything work:
./usr/local/bin/wkhtmltopdf 'https://google.de' google.pdf

Bugs

typeset.sh

typeset.sh is based on PHP

Price: 500 EUR for Self-hosted Version

mPDF

mPDF

Dompdf

dompdf

Encrypted PDF

https://gist.github.com/marcus-at-localhost/04bebc64832cd618a872e146a0e48b26#file-info-md

FPDI

FPDI is used to merge PDFs. It needs the FPDF library to work.

  1. Download latest version of FPDI
  2. Download FPDI_Protection
  3. Download FPDF

Simple example

    require_once('fpdf181/fpdf.php');
    require_once('FPDI-1.6.1/fpdi.php');
    require_once('FPDI-1.6.1/FPDI_Protection.php');
    $pdf = new FPDI_Protection();
    $pagecount = $pdf->setSourceFile($origFile);

    // copy all pages from the old unprotected pdf in the new one
    for ($loop = 1; $loop <= $pagecount; $loop++) {
        $tplidx = $pdf->importPage($loop);
        $pdf->addPage();
        $pdf->useTemplate($tplidx);
    }

    $pdf->SetProtection(array('print'),null, $password);
    $pdf->Output($destFile,'F'); // F write, D download