Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow users to provide FSSupplier<PDFont> in PdfBoxFontResolver to avoid duplicate fonts/subsets #383

Closed
DSW-PS opened this issue Sep 6, 2019 · 2 comments

Comments

@DSW-PS
Copy link
Contributor

DSW-PS commented Sep 6, 2019

Hi @danfickle

what do you think about adding a method to the PdfBoxFontResolver that allows users to use their own FSSupplier?

This way it would be possible to avoid having duplicate fonts (or fonts with several subsets) in the PDF by using some sort of font-cache.

This quite easily happens if you have openhtmltopdf produce the output in a PDDocument where you also manually add some text which uses (some of) the same fonts as the html.
In this case it would be up to the implementation of FSSupplier to either load the PDFont or serve a already loaded one.

I can provide a pull-request for this.

@danfickle
Copy link
Owner

Hi @DSW-PS,

I wouldn't be opposed to a pr. However, i think i'd prefer a method on the PDF builder if that's possible. In the meantime, you may be able to get added fonts from the page resource dictionary of the pddocument.

@DSW-PS
Copy link
Contributor Author

DSW-PS commented Sep 9, 2019

Hi @danfickle,
I created the pr.

I wasn't too keen on reordering the method parameters to keep the FSSupplier directly in the method as it would clash with the ones that use FSSupplier.
Instead I moved the PDFontSupplier from PdfBoxFontResolver to a seperate class that can be extended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants