nextcloud / nextcloud/richdocuments
Template creator for PDF files
Open
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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- 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