Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCPDI Uninitialized string offset: 35 #29

Open
AlexRederstein opened this issue Feb 29, 2024 · 0 comments
Open

TCPDI Uninitialized string offset: 35 #29

AlexRederstein opened this issue Feb 29, 2024 · 0 comments

Comments

@AlexRederstein
Copy link

Hello! I have a code with which I add a png image to a pdf document. But if you upload a document larger than 1MB, an error occurs: Uninitialized string offset: 35. Here is my code:
` $pdf = new TCPDI(PDF_PAGE_ORIENTATION, 'px', PDF_PAGE_FORMAT, true, 'UTF-8', false);
$lists = $pdf->setSourceFile($file_dir);
$pdf->SetAutoPageBreak(false);
for($i=1; $i<=$lists; $i++) {
$import = $pdf->importPage($i);
$size = $pdf->getTemplatesize($import);
$pdf->AddPage($size['w'] > $size['h'] ? 'L' : 'P');
$pdf->useTemplate($import, 0, 0);
if($i==$lists){
$res = getimagesize(stream_get_meta_data($this->sign)['uri']);
$pdf->SetY(-$res[1] / 2 - 10);
$pdf->SetX(-$res[0] / 2 - 10);
$pdf->Image(stream_get_meta_data($this->sign)['uri'], $pdf->getX(), $pdf->getY(), $res[0] / 2, $res[1] / 2);
}
}

	$tmp = tmpfile();
	$pdf->output('test.pdf','I');
	return base64_encode(file_get_contents(stream_get_meta_data($tmp)['uri']));

Php.ini config:max_execution_time = 60
max_input_vars = 5000
memory_limit = -1
post_max_size = 128M
upload_max_filesize = 50M
`
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant