Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added QR Code support:

This change generates a QR Code for the URL that is exported to pdf. As QR Codes normally only make sense on printed documents I decided to add it directly to the PDF. To get the QR Code in the PDF you can use the @QRCODE@ replacement pattern within the desired template.
  • Loading branch information...
commit d9ff9cfac32cb94f0e8565e03120dc17665c0359 1 parent df59f40
Johannes Fürwentsches jfuerwentsches authored
Showing with 7 additions and 0 deletions.
  1. +7 −0 action.php
7 action.php
View
@@ -194,6 +194,12 @@ protected function load_template($title){
}
}
+ // generate qr code for this page using kaywa.com
+ $protocol = ($_SERVER['HTTPS']) ? 'https://' : 'http://';
+ $url = $protocol.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
+ $url = str_replace("?do=export_pdf", "", $url);
+ $qr_code = '<img src="http://qrcode.kaywa.com/img.php?s=3&d='.$url.'">';
+
// prepare replacements
$replace = array(
'@ID@' => $ID,
@@ -207,6 +213,7 @@ protected function load_template($title){
'@DATE@' => dformat(time()),
'@BASE@' => DOKU_BASE,
'@TPLBASE@' => DOKU_PLUGIN.'dw2pdf/tpl/'.$tpl.'/',
+ '@QRCODE@' => $qr_code,
);
// set HTML element
Please sign in to comment.
Something went wrong with that request. Please try again.