> On 2023-07-03, Bram Moolenaar <b...@moolenaar.net> 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.
I could find help with: % qpdf --help=encryption Create encrypted files. Usage: --encrypt user-password owner-password key-length [options] -- Either or both of user-password and owner-password may be empty strings. key-length may be 40, 128, or 256. Encryption options are terminated by "--" by itself. I don't like passing the password on the command line, but I suppose there is no other way. There is no explanation of "user-password" and "owner-password", other than that they may be empty. Is there a recommended usage? > > 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. The big question is: is this safe? Is it impossible for someone else to get the text in not encrypted form? > 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. OK, so there are options. Which one should we use? I can guess that "ram://" specifies using a RAM disk. What is the "204800" for? -- If it's sent by ship then it's cargo. If it's sent by road then it's a shipment. Dave Allen /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- -- 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 vim_mac+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_mac/20230704221058.55E681C0B44%40moolenaar.net.