Skip to content

PDF output with text #68

Answered by codemasher
OndrejSirocka asked this question in Q&A
Discussion options

You must be logged in to vote

Extending the output modules is quite easy. Assuming you want to modify the FPDF object after writing the QR Code, just do as follows:

namespace My\App;

use chillerlan\QRCode\Output\QRFpdf;

class QRFpdfCustom extends QRFpdf{

	public function dump(string $file = null){
		// force set returnResource to true to get the FPDF object in the next step
		$this->options->returnResource = true;
		// retrieve the FPDF object
		$fpdf = parent::dump();

		// modify the PDF
#		$fpdf->Text($x, $y, 'text');

		// ...

		// proceed and mimic the output behaviour of the parent method
		$pdfData = $fpdf->Output('S');

		if($file !== null){
			$this->saveToFile($pdfData, $file);
		}

		if($this->options->i…

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by codemasher
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #65 on March 12, 2021 19:02.