If you are going to implement pdflatex in your PHP application.
for mine it was codeignitor.
Step 1: install pdflatex.
Step 2: install pdfannotextractor $ pdfannotextractor --install in your terminal
Step 3: $ pdfannotextractor --version this will helps to find your PDFAnnotExtractor version in your terminal.
Step 4: But Pdfannotextractor also requires package libpdfbox-java. Otherwise we will get this error !!! Error: Cannot find PDFBox library!
Step 5: You can download pdfbox from this link https://sourceforge.net/projects/pdfbox/files/PDFBox/PDFBox-0.7.3/
Step 6: Extract the zip file and copy paste the unzipped folder in your application.
Step 7: Follow this code.
$file = '/home/rebin/Downloads/file.pdf';
$pdflatex = '/usr/local/texlive/2016/bin/x86_64-linux/pdflatex';
$pdf_box = BASEPATH.'PDFBox-0.7.3/lib/PDFBox-0.7.3.jar';
$template_file = 'user/join_template.tex';
$new_pdf_filename = 'new_pdf';
$temp_join_file_path = 'user/';
shell_exec("CLASSPATH='".$pdf_box.":%CLASSPATH%' pdfannotextractor ".$file);
$doc = '\documentclass{article}
\usepackage{hyperref}
\usepackage[left=1cm, right=1cm, top=2cm, bottom=2cm]{geometry}
\usepackage{pdfpages}
\usepackage{pax}
\begin{document}
\includepdf[page=-]{' . $file. '}
\end{document}';
file_put_contents($template_file, $doc);
shell_exec($pdflatex . ' -output-directory=' . $temp_join_file_path . ' -jobname=' . $new_pdf_filename . ' -interaction=nonstopmode -shell-escape join_template.tex');
Your pdf file will be generated without any missing links.
Array( [0] => Array( [text] => Text 1 [href] => http://www.example.com ) [1] => Array ( [text] => Text 2 [href] => http://www.example.com ) )I need to add links for its appropriate texts. – Rebin Joseph Mar 27 '20 at 08:45