mirror of
https://github.com/gotenberg/gotenberg.git
synced 2026-08-08 00:22:14 +01:00
feat: add PDF encryption feature (#1217)
* Adding PDF encryption option * LibreOffice * QPDF * PDFtk * pdfcpu * Update pkg/modules/pdfengines/pdfengines.go Co-authored-by: Julien Neuhart <neuhart.julien@gmail.com> * npx prettier * go fmt * PR comments * Update test/integration/scenario/scenario.go Co-authored-by: Julien Neuhart <neuhart.julien@gmail.com> * renamed ProtectWithPassword to encrypt * more clean up * Use the same input path as requested * This commit completes the encryption implementation * Clean up. Added webhook, disable route and download from tests --------- Co-authored-by: Julien Neuhart <neuhart.julien@gmail.com>
This commit is contained in:
committed by
Julien Neuhart
parent
638c4e6b23
commit
99307befdd
@@ -30,6 +30,7 @@ func convertRoute(libreOffice libreofficeapi.Uno, engine gotenberg.PdfEngine) ap
|
||||
splitMode := pdfengines.FormDataPdfSplitMode(form, false)
|
||||
pdfFormats := pdfengines.FormDataPdfFormats(form)
|
||||
metadata := pdfengines.FormDataPdfMetadata(form, false)
|
||||
userPassword, ownerPassword := pdfengines.FormDataPdfEncrypt(form)
|
||||
|
||||
zeroValuedSplitMode := gotenberg.SplitMode{}
|
||||
|
||||
@@ -277,6 +278,11 @@ func convertRoute(libreOffice libreofficeapi.Uno, engine gotenberg.PdfEngine) ap
|
||||
}
|
||||
}
|
||||
|
||||
err = pdfengines.EncryptPdfStub(ctx, engine, userPassword, ownerPassword, outputPaths)
|
||||
if err != nil {
|
||||
return fmt.Errorf("encrypt PDFs: %w", err)
|
||||
}
|
||||
|
||||
err = ctx.AddOutputPaths(outputPaths...)
|
||||
if err != nil {
|
||||
return fmt.Errorf("add output paths: %w", err)
|
||||
|
||||
Reference in New Issue
Block a user