cooltronicpl / Craft-document-helpers

Craft CMS 3 and 4, 5 plugin enabling PDF document generation from template Twig files, code blocks and URLs
Other
13 stars 6 forks source link

Change the head title of PDF document #4

Closed parwinderD4D closed 3 years ago

parwinderD4D commented 3 years ago

Hi, could you please let me know how I can change the head title for the pdf document?

My PDF HTML Code

Please ceck my HTML code image

Code for download PDF

image

This is what I am getting in the output : image

Any idea how I can replace or change this text.

Looking forward

cooltronicpl commented 3 years ago

This is a fragment of code for title handling:: if(isset($variables['title'])) $pdf->SetTitle($variables['title']); This should add a variable that will change the title: {% set pdfOptions = { ..., title: "The title" } %}

parwinderD4D commented 3 years ago

Thanks for the quick reply, {% set pdfOptions = { ..., title: "The title" } %} It's not working, As I have reviewed the plugin code where the title is getting from $variables not from the $attributes . image

image due to this title is not override

if I modify the code if(isset($attributes['title'])){ $pdf->SetTitle($attributes['title']); } else if(isset($variables['title'])){ $pdf->SetTitle($variables['title']); } Then only custom Title override in pdf

could you please update this code in the plugin?

Looking forward

cooltronicpl commented 3 years ago

We added in version 0.0.6 a custom attribute of the title, described in the README.