EDIT: If you are using Bootstrap, then it is most likely the reason for this problem. Read here.
I'm trying to generate a PDF of a twig template using KnpSnappyBundle.
The problem is that the generated PDF is displaying the actual link in addition to the link text for all links when it is generated, like in this image:
Is there an option for this within wkhtmltopdf? I've looked at the options using wkhtmltopdf -H
and neither disable-external-links
nor disable-internal-links
resolves this.
Here is the code I'm using to generate the PDF:
$this->get('knp_snappy.pdf')->generateFromHtml(
$this->renderView(
$template,
array(
$key => $array
)
),
$this->container->getParameter("upload_dir") . '/' . $file,
array(
"print-media-type" => true,
"disable-external-links" => true,
"disable-internal-links" => true
)
);
And the HTML:
<a href="{{ path('work_descriptions') }}#{{ value.descriptionId }}" target="_blank" class="work-link"><strong><u>{{ title }}</u></strong></a>
And yes, I know the {{ title }}
value does not include the actual link because when I use it outside of a link tag, the PDF displays it fine.
I'm trying my best to avoid hacky solutions, but I'm not sure what the problem is.
UPDATE: The problem happens regardless of whether twig variables are used or not.