fpdf.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. 'imageBase64' => false,
  12. 'moduleValues' => [
  13. // finder
  14. 1536 => [0, 63, 255], // dark (true)
  15. 6 => [255, 255, 255], // light (false), white is the transparency color and is enabled by default
  16. // alignment
  17. 2560 => [255, 0, 255],
  18. 10 => [255, 255, 255],
  19. // timing
  20. 3072 => [255, 0, 0],
  21. 12 => [255, 255, 255],
  22. // format
  23. 3584 => [67, 191, 84],
  24. 14 => [255, 255, 255],
  25. // version
  26. 4096 => [62, 174, 190],
  27. 16 => [255, 255, 255],
  28. // data
  29. 1024 => [0, 0, 0],
  30. 4 => [255, 255, 255],
  31. // darkmodule
  32. 512 => [0, 0, 0],
  33. // separator
  34. 8 => [255, 255, 255],
  35. // quietzone
  36. 18 => [255, 255, 255],
  37. ],
  38. ]);
  39. \header('Content-type: application/pdf');
  40. echo (new QRCode($options))->render($data);