richdocuments icon indicating copy to clipboard operation
richdocuments copied to clipboard

Template creator for PDF files

Open juliusknorr opened this issue 6 months ago • 0 comments

Small patch used for testing in the frontend, but needs a few more adjustments:

  • [ ] Only expose if pdftk library is installed
  • [ ] Extend template picker to be able to hide the empty template which does not make sense for PDF files
diff --git a/lib/Listener/RegisterTemplateFileCreatorListener.php b/lib/Listener/RegisterTemplateFileCreatorListener.php
index c538da96d..7f3875270 100644
--- a/lib/Listener/RegisterTemplateFileCreatorListener.php
+++ b/lib/Listener/RegisterTemplateFileCreatorListener.php
@@ -93,5 +93,13 @@ class RegisterTemplateFileCreatorListener implements IEventListener {
                        $odpType->setRatio(1);
                        return $odpType;
                });
+
+               $templateManager->registerTemplateFileCreator(function () use ($appPath) {
+                       $odpType = new TemplateFileCreator('richdocuments', $this->l10n->t('New PDF'), '.pdf');
+                       $odpType->addMimetype('application/pdf');
+                       $odpType->setIconSvgInline(file_get_contents($appPath . '/img/pdf.svg'));
+                       $odpType->setRatio(1);
+                       return $odpType;
+               });
        }
 }

juliusknorr avatar Aug 01 '24 14:08 juliusknorr