danfickle / openhtmltopdf

An HTML to PDF library for the JVM. Based on Flying Saucer and Apache PDF-BOX 2. With SVG image support. Now also with accessible PDF support (WCAG, Section 508, PDF/UA)!
https://danfickle.github.io/pdf-templates/index.html
Other
1.93k stars 360 forks source link

Want to add/define out link font but not embedded font #891

Open danmaidesenling opened 1 year ago

danmaidesenling commented 1 year ago

Hi, I want to add out source font in my generated PDF. I don't know how to describe it. I mean adding a font family in my CSS, who can see the the right font ONLY when installed the Font in his/her machine. This is not embedded font obviously. I can achieve this feature through flying saucer. (No offence, openthmltopdf is great to use.) ITextFontResolver fontResolver = renderer.getFontResolver(); fontResolver.addFont("C:\\Windows\\Fonts\\MICR.ttf",false);// here you can see the false switch to open embedded or not But I don't know how to achieve this in openhtmltopdf, Could you please advise this ? here is what I do in openhtmltopdf PdfRendererBuilder builder = new PdfRendererBuilder(); builder.useFastMode(); builder.withFile(new File("E:\\webapp\\data\\af59dc16-19a0-40b9-bc6a-ca9a4eb53589.html")); builder.toStream(os); builder.run(); here is the css font reference. .serialCode { position: relative; top: 3.7in; width: 7.6in; height: 0.25in; font-size: 0.1041666667in; font-style: normal; text-align: left; font-family: MICR; // the font family name left: 1.439in; letter-spacing: 0.0283in; top: 3.715in; font-weight: 600; }

danmaidesenling commented 1 year ago

Can anyone help me out : )