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

Find element and get coordinates #746

Open
Kossin7 opened this issue Sep 11, 2024 · 0 comments
Open

Find element and get coordinates #746

Kossin7 opened this issue Sep 11, 2024 · 0 comments

Comments

@Kossin7
Copy link

Kossin7 commented Sep 11, 2024

Hello!
I need to insert an image at a specific location
Is it possible to find an element by text and get its coordinates in order to insert an image in the right place based on them?

use setasign\Fpdi\Tcpdf\Fpdi;
$pdf = new Fpdi();
$pdf->SetPrintHeader(false);
$pdf->SetPrintFooter(false);
$pdf->AddPage();
$pdf->setSourceFile(base_path().'/10147.pdf');

$tplId = $pdf->importPage(1);
$pdf->useTemplate($tplId, 0, 0);

// Example code: 
// search element by text
// $el = $pdf->findByText('SomeText');
//$pdf->Image(base_path().'/pechat.png', $el ->getX() + 40, $el ->getY() + 40 , 35, 35, 'PNG', '', '', true);
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