Suggestions for creating PDF of a single note

I often export single notes to PDF. Any ideas on a simple workflow to do that with Notenik?

I would use Marked app, but I can’t see a way for it to display the Title field as <h1>.

I am guessing it would involve familiarising myself with Pandoc.

At the most, this suggestion can help you get the ball rolling, or someone else can build off of it:

  1. In your collection settings change “Note Title Display” to H1.
  2. Option + Command + S to share your note.
    • Content: Entire note
    • Format: HTML document
    • Destination: Write to file
  3. Save file wherever.
  4. Convert the HTML file to PDF with Pandoc.

An alternative is to keep a local mirror of your Notenik collection that will keep a copy of every note in HTML format. Select Rerun mirror indexing with every update? in your collection preferences to keep the mirror up-to-date. Then you could just run Pandoc on whichever note you choose to convert to a PDF. I would start with making your entire Collection, directory and all, and running Transform > Generate sample Mirror folder. From there you can adjust the merge template and the script to your liking.

I’d even go as far as to make a .md merge template that start with something like:

<?nextrec?>
<?output "=$title&f$=.md"?>

# =$title$=

=$body$=

<?loop?>

And feed the output to Marked and call it a day.

In short, you’ve got options man.

How do you want to do it? Answer that question, then consult the Knowledge Base and Herb’s GitHub repos.

1 Like

Thanks for the pointers. Think I’ll explore the Mirror option in more detail, which in combination with some print CSS means I could bypass Marked and Pandoc entirely and simply save to PDF from the browser.

I have to admit, I flipped through the Knowledge Base pretty quickly and missed the Share your note option.

I assumed it was the standard macOS Share option.

Export sounds better to me, but it is already used for exporting a collection.

After this fine discussion, it occurred to me that it might make sense to add another Destination option to the ‘Share a Note’ window to open the output in your web browser. From there, of course, it’s easy to save the page to a PDF, as you note, @wgrace. See attached for a test version that allows you to do just that. I’d appreciate any feedback either of you might have. BTW, use of this option will result in your selected notes being saved as HTML pages in a sub-folder named browse.
Notenik 2022-12-05 16-54-17.zip (16.0 MB)

1 Like

Yeah, it never occurred to me to add a @page rule to a collection’s display.css. I’m excited to try this feature out. I hope to report back if necessary.

@wgrace and @ThePrinter : See the latest beta version available for download in the new Beta Versions category. This includes the addition to the ‘Share w/Options’ screen of ‘Open in Browser’ as a Destination. This allows you to quickly and easily open a Note in your preferred Web browser; from there, you can easily print it or send it to a PDF.

I tested today and it works great – thank you.

1 Like