This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
There is some Plugin that generates PDF with the information that a model saves, as well as add extra text in the upper and lower parts as well as the pdf can also be downloaded. Thank you so much
You may try https://octobercms.com/plugin/renatio-dynamicpdf and let me know if you can make it work. I can not figure out why my images are displayed in bad quality, even when evreything is set to 300DPI.
Last updated
virgo9793756674 said:
I'm just testing that plugin, only I can't put a download button in the model form
Front end or backend form?
virgo9793756674 said:
back-end
Well... I need to learn lot about backend forms and I'll need that functionality as well. My guess at the moment is that I'll try to figure out how it is done in the plugin. There is the "Preview PDF" button. Check plugins\renatio\dynamicpdf\controllers\templates\previewpdf.htm and plugins\renatio\dynamicpdf\controllers\Templates.php files.
But I need to solve the image prolem first.
I would appreciate if you share your solution when you figure it out.
virgo9793756674 said:
I'm just testing that plugin, only I can't put a download button in the model form
I figured it out:
In order to add the download button you can open [ plugins\YOURNAME\YOURPLUGIN\controllers\YOURCONTROLLER\update.htm ] file then add the following code after last</button>
, or other place if you want:
<a class="btn btn-info"
href="<?= Backend::url('plugins\YOURNAME\YOURCONTROLLER/pdf/' . $formModel->id) ?>">
<?= e(trans('Download')) ?>
</a>
Then in the [ plugins\YOURNAME\YOURPLUGIN\controllers\YOURCONTROLLER ] file, add a simlar function:
public function pdf($id)
{
$templateCode = 'newsletter-test-template'; // unique code of the template
$data = ['name' => 'John Doe']; // optional data used in template
return PDF::loadTemplate($templateCode, $data)
->download('download.pdf');
}
I don't know if this is the correct way to do it, but I'll try to go on with this.
1-7 of 7