chore(pdf): use pdf encryption on admin test page
This commit is contained in:
parent
09b2a88b4e
commit
56c2847b45
@ -304,6 +304,11 @@ getAdminTestPdfR = do
|
|||||||
case content of
|
case content of
|
||||||
Right (Right bs) -> do
|
Right (Right bs) -> do
|
||||||
liftIO $ LBS.writeFile "/tmp/generated.pdf" bs
|
liftIO $ LBS.writeFile "/tmp/generated.pdf" bs
|
||||||
sendByteStringAsFile "demoPDF.pdf" (LBS.toStrict bs) now
|
mbEncPdf <- encryptPDF "tomatenmarmelade" bs
|
||||||
|
case mbEncPdf of
|
||||||
|
Left err -> sendResponseStatus internalServerError500 $ decodeUtf8 $ LBS.toStrict $ "PDFtk error: \n" <> err
|
||||||
|
Right encPdf -> do
|
||||||
|
liftIO $ LBS.writeFile "/tmp/crypted.pdf" encPdf
|
||||||
|
sendByteStringAsFile "demoPDF.pdf" (LBS.toStrict bs) now
|
||||||
Right (Left err) -> sendResponseStatus internalServerError500 $ decodeUtf8 $ LBS.toStrict $ "LaTeX compile error: \n" <> err
|
Right (Left err) -> sendResponseStatus internalServerError500 $ decodeUtf8 $ LBS.toStrict $ "LaTeX compile error: \n" <> err
|
||||||
Left err -> sendResponseStatus internalServerError500 $ "Pandoc error: \n" <> P.renderError err
|
Left err -> sendResponseStatus internalServerError500 $ "Pandoc error: \n" <> P.renderError err
|
||||||
|
|||||||
@ -68,7 +68,11 @@
|
|||||||
<section>
|
<section>
|
||||||
<h2>
|
<h2>
|
||||||
Erzeugtes PDF herunterladen:
|
Erzeugtes PDF herunterladen:
|
||||||
Hier ist ein
|
<p>
|
||||||
<a href=@{AdminTestPdfR}>
|
Hier ist ein
|
||||||
Download-Link
|
<a href=@{AdminTestPdfR}>
|
||||||
für eine PDF Vorschau.
|
Download-Link
|
||||||
|
für eine PDF Vorschau.
|
||||||
|
<p>
|
||||||
|
Zusätzlich wird dabei im Verzeichnis /tmp
|
||||||
|
das PDF mit und ohne Passwort gespeichert.
|
||||||
@ -69,7 +69,12 @@
|
|||||||
<section>
|
<section>
|
||||||
<h2>
|
<h2>
|
||||||
Download a generated PDF
|
Download a generated PDF
|
||||||
Here is a
|
<p>
|
||||||
<a href=@{AdminTestPdfR}>
|
Here is a
|
||||||
Download-Link
|
<a href=@{AdminTestPdfR}>
|
||||||
for a preview.
|
Download-Link
|
||||||
|
for a preview.
|
||||||
|
<p>
|
||||||
|
Following the link, the pdf will also be saved
|
||||||
|
to the /tmp directory, once without
|
||||||
|
and once with password protection.
|
||||||
Reference in New Issue
Block a user