fpdf.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace chillerlan\QRCodeExamples;
  3. use chillerlan\QRCode\{QRCode, QROptions};
  4. require_once __DIR__ . '/../vendor/autoload.php';
  5. $data = 'https://www.youtube.com/watch?v=DLzxrzFCyOs&t=43s';
  6. $options = new QROptions([
  7. 'version' => 7,
  8. 'outputType' => QRCode::OUTPUT_FPDF,
  9. 'eccLevel' => QRCode::ECC_L,
  10. 'scale' => 5,
  11. 'moduleValues' => [
  12. // finder
  13. 1536 => [0, 63, 255], // dark (true)
  14. 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  15. // alignment
  16. 2560 => [255, 0, 255],
  17. 10 => [255, 255, 255],
  18. // timing
  19. 3072 => [255, 0, 0],
  20. 12 => [255, 255, 255],
  21. // format
  22. 3584 => [67, 191, 84],
  23. 14 => [255, 255, 255],
  24. // version
  25. 4096 => [62, 174, 190],
  26. 16 => [255, 255, 255],
  27. // data
  28. 1024 => [0, 0, 0],
  29. 4 => [255, 255, 255],
  30. // darkmodule
  31. 512 => [0, 0, 0],
  32. // separator
  33. 8 => [255, 255, 255],
  34. // quietzone
  35. 18 => [255, 255, 255],
  36. ],
  37. ]);
  38. \header('Content-type: application/pdf');
  39. echo (new QRCode($options))->render($data);