mnelson4 / printmyblog

WordPress Plugin that simplifies printing your entire blog

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Custom job for Joseph Fugallo on aat.mn

mnelson4 opened this issue · comments

Joseph needs to provide a PDF and print user manual in many languages. The manual is just a page on his website. Visitors can download a PDF of the page OK (and Joseph has manually added spacers to the page to make it layout nicely), but when they switch languages, the content's length changes and so his spacers are off.
Also, the plugin he uses for translations, gTranslate, didn't work with PMB.

On Test site

  • make gTranslate work with PMB's Quick Print and Pro Print
  • make it work even when using gTranslate's sub-directory or sub-domain URL structure
  • in Pro Print, the TOC is in the wrong language after downloading a file then changing the language. The language switcher should probably just disappear to prevent this.
  • hide elementor TOC in Quick Print because it doesn't work(leave it in Pro Print)

On Production Site

  • get FTP access
  • instead of using spacers, use CSS break-before to control page breaks (or ideally avoid page breaks between certain items, although browsers probably don't support this well) --> doesn't work well unless items are nestled together under a common div or something
  • break-after:avoid and page-break-after:avoid I can't get to ever work
  • the parent wrapper needed to not be flex, instead just be a block
  • putting "aat-break-before" on a section made the heading disappear;
  • try grouping content using elementor sections
  • try making images a little smaller
  • use more targetted css selectors to only target stuff we want to use pagebreaks on, leave other unborked
  • replace spacers with pagebreaks
  • make gTranslate work with PMB's Quick Print and Pro Print
  • make it work even when using gTranslate's sub-directory or sub-domain URL structure
    • maybe using columns will avoid the problem of content being separated in the PDF (or at least reduce it)
    • Pro Print can do this better, but we'd basically need frontend print buttons that use Pro Print
  • in Pro Print, the content mostly disappears mysteriously (I think it gets moved off the side of the page). Preven that.
  • upload a new PMB that works with gTranslate and otherwise fixes these issues
  • hide elementor TOC in Quick Print because it doesn't work(leave it in Pro Print)

ended up just tidying up their print CSS, added some custom CSS to their site, use custom CSS classes "aat-big-image" and "aat-page-break" instead of spacers, and added a print button. If the customer likes it, I'll implement on the live page.

Also added

  • "aat-no-transform-in-print" to disable transforms on elements (which sometimes work well in print)
  • "aat-allow-margin-in-print" because I'm removing all margins on elements (usually look bad) but this allows them again

It seems we're going to just use the browser's native print abilities for v1, which is mostly ready.
To do to depoy:

  • add necessary CSS classes to the live version of the page (or make the test one the new live, assuming the live one hasn't changed)
  • update CSS to not target that specific page, but all pages (which makes the CSS selectors less specific so they might get overridden, so watch out)
  • add print button on the page
  • Joe wanted to have a javascript popup when printing, advising on best page margins to use

V2 will be to use Pro Print Frontend buttons. For that I'll need:

  • implement pro print for front end buttons
  • file caching system will need to be aware of Gtranslate and which language is being requested
  • to save on clicking, when updating a page for all languages, open the window in separate tab maybe?