[TikiWiki-commits] [Git][tikiwiki/tiki][26.x] [ENH] pdf print ajax service
"Victor Emanouilov \(@kroky\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <69144777c48f6_2ce3094737fa@gitlab-sidekiq-low-urgency-cpu-bound-v2-7898cb4754-mrldh.mail> |
Victor Emanouilov pushed to branch 26.x at Tiki Wiki CMS Groupware / Tiki
Commits:
ad6e19e0 by Victor Emanouilov at 2025-11-12T10:38:08+02:00
[ENH] pdf print ajax service
---
* [FIX] pipeline
* [ENH] pdf print ajax service
See merge request tikiwiki/tiki!9010
- - - - -
2 changed files:
- doc/devtools/codesniffer/standards/TikiIgnore/ignore_list.json
- lib/core/Services/PDF/Controller.php
Changes:
=====================================
doc/devtools/codesniffer/standards/TikiIgnore/ignore_list.json
=====================================
@@ -5397,6 +5397,7 @@
"Services_Payment_Controller::action_capture": true
},
"lib\/core\/Services\/PDF\/Controller.php": {
+ "Services_PDF_Controller::action_get_pdf": true,
"Services_PDF_Controller::action_storeTable": true,
"Services_PDF_Controller::action_checkPDFFile": true
},
=====================================
lib/core/Services/PDF/Controller.php
=====================================
@@ -11,6 +11,35 @@ class Services_PDF_Controller
Services_Exception_Disabled::check('feature_wiki_print');
}
+ public function action_get_pdf($input)
+ {
+ // edit permission is needed to convert arbitrary text to PDF
+ if (! Perms::get()->edit) {
+ throw new Services_Exception_Denied();
+ }
+
+ $contents = $input->contents->html();
+ $filename = $input->filename->text();
+
+ if (empty($filename)) {
+ $filename = 'contents.pdf';
+ }
+
+ require_once 'lib/pdflib.php';
+ $generator = new PdfGenerator();
+ if (! empty($generator->error)) {
+ Feedback::error($generator->error);
+ return "";
+ } else {
+ $pdf = $generator->getPdf('tiki-print.php', [], $contents);
+ header('Content-Type: application/pdf');
+ header('Content-Disposition: attachment; filename="' . $filename . '"');
+ header('Content-Length: ' . strlen($pdf));
+ echo $pdf;
+ exit;
+ }
+ }
+
//function added to hold current state of fancy table / sorted table for pdf and print version. So when user generates pdf he gets his sorted data not default data in table.
public function action_storeTable($input)
{
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ad6e19e089bb232eaf7279ee85b66179bc72e35c
--
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/ad6e19e089bb232eaf7279ee85b66179bc72e35c
You're receiving this email because of your account on gitlab.com.
_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs