kibi / lanyardpendant
LanyardPendant is a PHP class for generating PDF lanyard pendants
Installs: 181
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
README
LanyardPendant is a PHP class for generating PDF lanyard pendants
Installation
with Composer
composer require kibi/lanyardpendant
via require (download current release manually)
require_once('path/to/src/LanyardPendant.class.php');
Sample usage
require_once('vendor/autoload.php'); $pdfName = 'Namensschild.pdf'; $pdf = LanyardPendant($pdfName); $pdf->SetCreator("Creator name"); $pdf->SetAuthor("Author name"); //Nur zu Testzwecken $pdf->setPDFBackgroundDocumentPath(dirname(__FILE__).'/LanyardPendantBackground-sample.pdf'); $pdf->AddPage(); $pdf->drawHolePunch(); //Nur zu Testzwecken $pdf->writeName('Max'); $pdf->writeName('Mustermann'); //$pdf->writeName('Mustermann von Musterhausenstein'); //Automatische Anpassung der Schriftgröße an Textlänge (-> Immer nur eine Zeile) $pdf->writePersonalCompany('Meine Musterfirma'); $pdf->writePersonalPosition('Event Manager'); $pdf->writePersonalTextField('<b>Sprich mich an, wenn...</b><br>du dich für Co-Workingspaces, Events, Hackathons & Networking interessierst'); $pdf->writePersonalQRCode('https://example.com/link/to/my/profile'); //PDF DIREKT AUSGEBEN $pdf->Output($pdfName.'.pdf', 'I');
Print lanyard pendants using Druckerwolke (Cloud Printing Service)
Setup your Account
- Create your account at https://druckerwolke.de
- Create your API username and password in the login area at https://durckerwolke.de.
- Request your API key at support@druckerwolke.de
Install Druckerwolke
with Composer
composer require kibi/druckerwolke
via require (download current release manually)
require_once('path/to/src/Druckerwolke.class.php');
Then add the following section to your code:
$file_content = $pdf->Output($pdfName.'.pdf', 'S'); $username = 'XXX'; $password = 'XXXXXXXXXX'; $api_key = 'XXXXXXXX-XXXX-MXXX-NXXX-XXXXXXXXXXXX'; $druckerwolke = Druckerwolke($username, $password, $api_key); $printers = $druckerwolke->printers(); // SELECT THE PRINTER $printer_id = $printers[0]->Id; //we are using the first printer $data = [ 'FileName' => $pdfName, 'MimeType' => 'application/pdf', 'FileDataBase64' => base64_encode($file_content), 'JobName' => 'Printing: '.$pdfName, 'DocumentVersion' => 0, 'InputQueueId' => $printer_id, 'FileSize' => 0, 'JobSettings' => [ 'PageOrientation' => 0 ], 'AdditionalParameters' => [] ]; $result = $druckerwolke->add_document($data);