On 2023-07-03, Bram Moolenaar <[email protected]> wrote:
> I suppose encrypting the file won't be possible, since the reader does
> not know how to decrypt it. Or does the Preview app support encryption
> somehow?
Yes, macOS's Preview supports (at least some?) encrypted PDFs. I did
a quick test by encrypting a random PDF document with qpdf:
qpdf --encrypt PASSWORD OWNERPASSWORD 256 -- in.pdf out.pdf
and by opening out.pdf with Preview, which prompted for a password
before opening the document.
> The alternative is to not use a temp file but write the text through a
> pipe/socket. That also avoids the need to find the right moment to
> delete the temp file. Can we do this somehow?
With Preview? I don't think so. But if one wants to get fancy, the PDF
can be written to the system clipboard and then Preview can be asked to
create a new document from the clipboard's content (using AppleScript).
Then, the clipboard content can be erased.
Or, even better, one could create a (sufficiently large) RAM disk with
something like:
hdiutil attach -nomount ram://204800
diskutil erasevolume APFS TempDisk /dev/diskN
use it as volatile storage, then destroy it:
diskutil eject /Volumes/TempDisk
The RAM disk can likely be formatted with an encrypted file system, too.
Life.
--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_mac/u7vfjq%246tk%241%40ciao.gmane.io.