fpdf.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * @created 03.06.2020
  4. * @author Maximilian Kresse
  5. * @license MIT
  6. */
  7. use chillerlan\QRCode\{QRCode, QROptions};
  8. use chillerlan\QRCode\Data\QRMatrix;
  9. require_once __DIR__ . '/../vendor/autoload.php';
  10. $options = new QROptions([
  11. 'version' => 7,
  12. 'outputType' => QRCode::OUTPUT_FPDF,
  13. 'eccLevel' => QRCode::ECC_L,
  14. 'scale' => 5,
  15. 'imageBase64' => false,
  16. 'moduleValues' => [
  17. // finder
  18. QRMatrix::M_FINDER_DARK => [0, 63, 255], // dark (true)
  19. QRMatrix::M_FINDER_DOT => [0, 63, 255],
  20. QRMatrix::M_FINDER => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  21. // alignment
  22. QRMatrix::M_ALIGNMENT_DARK => [255, 0, 255],
  23. QRMatrix::M_ALIGNMENT => [255, 255, 255],
  24. // timing
  25. QRMatrix::M_TIMING_DARK => [255, 0, 0],
  26. QRMatrix::M_TIMING => [255, 255, 255],
  27. // format
  28. QRMatrix::M_FORMAT_DARK => [67, 191, 84],
  29. QRMatrix::M_FORMAT => [255, 255, 255],
  30. // version
  31. QRMatrix::M_VERSION_DARK => [62, 174, 190],
  32. QRMatrix::M_VERSION => [255, 255, 255],
  33. // data
  34. QRMatrix::M_DATA_DARK => [0, 0, 0],
  35. QRMatrix::M_DATA => [255, 255, 255],
  36. // darkmodule
  37. QRMatrix::M_DARKMODULE => [0, 0, 0],
  38. // separator
  39. QRMatrix::M_SEPARATOR => [255, 255, 255],
  40. // quietzone
  41. QRMatrix::M_QUIETZONE => [255, 255, 255],
  42. ],
  43. ]);
  44. header('Content-type: application/pdf');
  45. echo (new QRCode($options))->render('https://www.youtube.com/watch?v=dQw4w9WgXcQ');