joelekstrom / fastmate

A native Fastmail-wrapper for Mac.
MIT License
194 stars 12 forks source link

Printing from Fastmate issues #31

Closed posguy99 closed 3 years ago

posguy99 commented 3 years ago

When logged into Fastmail in Safari, a print of an email will get:

A header left-justified, containing the subject, and right-justified, with the time it was printed A footer left-justified, with the actual Fastmail URL of the message, and right-justified, with the page count/total pages.

When Fastmate 1.64 prints, there are no headers and footers.

The margins are different from the Safari print as well.

Why are there no headers and footers?


The first time you select Print from an email in Fastmate, nothing happens. The second time, it displays the dialog.


If the resulting print would be less than a single page, Fastmate adds an additional blank page.

joelekstrom commented 3 years ago

Hi! Thanks for reporting. Sadly, since WKWebView (the modern web view which Fastmate (and Safari) uses) does not support printing for third party apps, Fastmate falls back to UIWebView when printing. So practically when Fastmail detects a print command, it creates a totally different web view internally, loads the same page, and then sends a print command to it. That's the why of it - the print will never exactly match Safari until Apple allows WKWebView to print in third-party apps. Also I never print myself so I don't notice when Fastmate doesn't keep up, so please keep reporting!

I think most of those can be fixed though. I do set some margins manually and can look into matching those of Safari. As for headers and footers, I may be able to emulate those as well but not sure. I'll need to look into the paging issue as well but since I have no printer I can't verify - do you see the extra blank page in the print preview window too?

joelekstrom commented 3 years ago

@posguy99 Hi again! I tried to update the print styling to look close to Safari, adding similar headers and footers. Also should fix the bug where it doesn't show up on the first time.

However, I cannot reproduce the last one (that fastmate adds an extra page if it's less than a single page).

Can you please try this binary and see if it fixes your problems? I cannot properly test since I don't own a printer. Thanks!

Fastmate-1.6.6-beta1.zip

posguy99 commented 3 years ago

Ok, 1.6.6-beta1 has headers and footers now, and it doesn't fail to print the first time you try to print. But it still prints extra pages (that now have headers and footers ^_^ )

I note that if I print an email of only a few lines, I do not get the extra page, while if the email extends into, maybe, the bottom third of the page, I get the second blank page. So it's email-dependent. Is there some setting wrt the frame the UIWebView is being rendered into that makes the frame extend into the second page, even though there's no content?

joelekstrom commented 3 years ago

I’m not sure actually, but that’s good information. I will try with some medium size emails. Can you verify that if you print to PDF you get the extra blank page there or not? I can only test with PDF printing and would like to understand if it’s different there

posguy99 commented 3 years ago

Yes, you still get the extra page.

joelekstrom commented 3 years ago

Thanks!

Also, since I need to render the new texts manually we could change them. Is email URL and title useful to have or is there maybe something better to put there?

joelekstrom commented 3 years ago

Fixed in v1.6.6