nextcloud / nextcloud/richdocuments

Template creator for PDF files

Open
#3,867 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

1. to develop enhancement feature: templates
Dominant language
JavaScript
Stars
453
Forks
147
Avg merge
14h 54m
Merged PRs (30d)
83

Description

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;
+               });
        }
 }

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in lib/Listener/RegisterTemplateFileCreatorListener.php and review the existing template creator registrations alongside the proposed PDF registration. Check how pdftk availability is detected and how the template picker represents empty templates. Done means PDF creation is exposed only with pdftk installed and the empty template can be hidden for PDF files.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.