bcgov / entity

ServiceBC Registry Team working on Legal Entities
Apache License 2.0
23 stars 58 forks source link

Look at/fix the file size of our pdf’s due to embedded fonts #6838

Open forgeuxGH5 opened 3 years ago

forgeuxGH5 commented 3 years ago

Per @thorwolpert "our PDF templates have the the BCGov fonts embedded in them, and they are eating a bunch of storage. It took the notification service offline and backed up into our other systems. Can we look at options? I know it’s a fork of one of the GoogleFonts, but do we really need to use it?"

This ticket is to investigate and hopefully implement an alternative approach to font handling in our pdfs to reduce file size.

Proposed assessment/investigation plan (test the impact/effects of the following):

  1. Remove any unused font files from the PDF's (Dejavu?)
  2. Options Plan A (POR) Work with the Relationship's team (or implement their solution?) to use the gov't weasyprint server Plan B Test using the Google Noto Sans font family instead of BC Sans (matching the same font sizes and weights as currently used) Use Arial font family as the back up system font for users without an internet connection or link to Google fonts cannot be made (matching the same font sizes and weights as currently used) 3.Assess the technical feasibility of the approach, effect on PDF file size, and the appearance and performance of PDF's (with and without internet connection)
  3. Change as necessary
tlebedovich commented 3 years ago

@forgeuxGH5 I would say:

  1. Test using the Google Noto Sans font family instead of BC Sans (matching the same font sizes and weights as currently used)
  2. Use Arial font family as the back up system font for users without an internet connection or link to Google fonts cannot be made (matching the same font sizes and weights as currently used)

Test both scenerios (with and without an internet connection)

thorwolpert commented 3 years ago

The Relationship team has a ticket they are working on to do this too. The common gov't weasyprint server has BCSans loaded in it, so we could do the same.

One issue with a ref to a non-standard font, is that when customers view their PDF, if it can't find it, or download it fast enough they get crappy font substitution going on.

tlebedovich commented 3 years ago

@thorwolpert - Great. Do we have control over which default system font gets substituted if/when BC Sans doesn't get downloaded fast enough? ie, as mentioned above, can we set Arial as the back up system font should BC Sans fail and if so, can we also map the font weights (ie BC Sans Bold maps to Arial Bold).

thorwolpert commented 3 years ago

I'm not sure on PDFs, I'd have to look into how they do their font substitution. I don't think it's like a FOUT.

thorwolpert commented 3 years ago

Here's what I got so far

Everyone suggests embedding font to maintain visual fidelity. So we may need to look at how the systems we have create and store PDFS, and then possibly embed the required fonts on delivery, if storage is a problem.

lmcclung commented 3 years ago

@thorwolpert Is this something that we could investigate after NRO decommision? Can we build our refund and renewal notifications like we currently do for now?

lmcclung commented 3 years ago

I threw an estimate on it for planning purposes. we can regroom when this ticket is picked up.

lmcclung commented 3 years ago

De-prioritizing this for now.