Bear Custom Formatted Print & PDF - Apple shortcut

Bear Custom Print & PDF - Apple shortcut

Updated: Mar 10, 2024 at 10:56 EDT

Customize Bear print, HTML and PDF production with Apple Shortcut
Download and install: Bear Custom Formatted Print & PDF - v.1.7 - Shortcut

User Defined Settings in Style Sheets

3 Sample Sheets are included in Shortcut and can be run as is.

  • Set page size and page numbering.
  • Set page break before heading 1 etc.
  • Set Page break after --- divider.
  • Set custom fonts, sizes or color for text and heading
  • Set center and max-size on images.
  • Using regular CSS style sheets, please add or update samples as needed.
    See section /*** My additions ***/, where you can override Bear’s default export style, using keyword !important; to ensure override “sticks”.
  • Select from multiple CSS style sheets, or run default without prompt (by moving the other sheets to subfolder.)
  • Print or save as PDF from Safari, Edge or Chrome (with page formatting)
  • On iPad/iPhone use preview in Textastic with Safari or Edge to print or share as PDF with images.

The three sample stylesheets are saved to folder: “iCloud/Shortcuts/CSS for Bear Print PDF/”
only first time the shortcut is run!
After that, modify the .CSS files directly in that folder to suit your needs.
If you want to restore the original samples: Temporarily move all files in “iCloud/Shortcuts/CSS for Bear Print PDF/” to a subfolder (so that root is empty of files), and they will be restored on next run :slight_smile:

Page formatting and page nubering is done by included javascript:
Paged.js — How to use Paged.js

/*** Special Section setting: page size, page numbering, ***/
/*** and page breaks; used by included JavaScript ***/
/*** (script added to output file by shortcut) ***/

@media print {
    @page {
        size: letter;
        margin-top: 20mm;
        margin-right: 10mm;
        margin-bottom: 20mm;
        margin-left: 10mm;
  
    @bottom-center {
        content: counter(page);
    }
}

h1 {break-before: page;}
/* h2 {break-before: page;} */

hr {
    /* Using Bear's --- divider */ 
    break-after: page;
    visibility: hidden;
}

NOTE! When Run on iOS/iPad

  1. Install Textastic app to be able to preview, print and make PDFs with images.
  2. Add “/iCloud Drive/Shortcuts/Bear Formatted Print Temp/” as External Folder in Textastic! Only needed to do once.
  3. When Shortcut opens Textastic: Open and preview “Bear Custom Formatted.html” from that external folder.
  4. Tap preview image 2 icon to preview and then image to view, print and make PDF in Safari or other default browser.
2 Likes