-
Notifications
You must be signed in to change notification settings - Fork 22
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
Hyperlinks in PDF #12
Comments
Did you find a solution for this problem ? To know if I need to check it |
A closing |
I now encountered the same problem. The PDF/A standard itself permits links:
|
Example PDFs: Created with atgp / factur-x (link not clickable) Source PDF (link clickable) Created with Mustang (link clickable) |
Hi @wq9578,
So maybe need to make a custom class (or enhance FpdfiFacturx class) to be able to preverse external links |
I have no experience with PDF editing in PHP for making a pull request. |
In FPDI 2.4.0 you can import PDF pages with external links now: https://github.com/Setasign/FPDI/releases/tag/v2.4.0 |
The problem seems to be in Facturx class : $tplIdx = $pdfWriter->importPage($i, '/MediaBox'); if It's replaced by this below, It works well ! $tplIdx = $pdfWriter->importPage($i, '/MediaBox', true, true); public function importPage(
$pageNumber,
$box = PageBoundaries::CROP_BOX,
$groupXObject = true,
$importExternalLinks = false // <= here
) |
Fixed into #28 : you can upgrade to v2 of this library. |
Hi,
I'am using this library which is really nice by the way.
I found an issue when the source pdf contains hyperlinks.
factur-x library seems to broke the hyperlinks in the PDF document.
The blue color and the underline style are still on the links but hitbox is removed to, so it is not possible to click on it anyome.
For information i use the following code :
`
// 1. generate the pdf with dompdf
$html = "my pdf with a <a href="https://github.com/atgp/factur-x/issues/new\">here link";
$options = new \Dompdf\Options();
$options->set('enable_php', true);
$options->set('enable_html5_parser', true);
$options->set('isRemoteEnabled', true);
$options->set('dpi', 192);
$dompdf = new \Dompdf\Dompdf($options);
$dompdf->setHttpContext(stream_context_create([
'ssl' => [
'verify_peer' => FALSE,
'verify_peer_name' => FALSE,
'allow_self_signed'=> TRUE
],
]));
$dompdf->loadHtml($html);
$dompdf->setPaper('A4', 'portrait');
$dompdf->render();
pdfoutput = $dompdf->output(); // links in this pdf works
//2. factur x
$facturex_xml = "...custom code here to generate the right xml as string, using \horstoeko\zugferd\ZugferdDocumentBuilder library...";
$facturx = new \Atgp\FacturX\Facturx();
$facturxPdf = $facturx->generateFacturxFromFiles($pdfoutput, $facturex_xml); // links are now broken
`
Is it a but to fix, or maybe i need to add some options in my code ?
Thanks a lot for your help.
The text was updated successfully, but these errors were encountered: