代码拉取完成,页面将自动刷新
最新版
可参考如下配置:
<?xml version="1.0"?>
<!-- NOTE: This is the version of the configuration -->
<fop version="1.0">
<!-- Base URL for resolving relative URLs -->
<base>.</base>
<!-- Source resolution in dpi (dots/pixels per inch) for determining the size of pixels in SVG and bitmap images, default: 72dpi -->
<source-resolution>72</source-resolution>
<!-- Target resolution in dpi (dots/pixels per inch) for specifying the target resolution for generated bitmaps, default: 72dpi -->
<target-resolution>72</target-resolution>
<!-- Default page-height and page-width, in case value is specified as auto -->
<default-page-settings width="21cm" height="29.7cm"/>
<!-- Information for specific renderers -->
<!-- Uses renderer mime type for renderers -->
<renderers>
<renderer mime="application/pdf">
<version>1.5</version>
<filterList>
<!-- provides compression using zlib flate (default is on) -->
<value>flate</value>
</filterList>
<fonts>
<!-- auto-detect fonts -->
<auto-detect/>
<!-- custom fonts-->
<font kerning="yes"
simulate-style="true"
embed-url="org/dromara/pdf/fop/font/SourceHanSerifSC-Regular.otf">
<font-triplet name="思源宋体" style="normal" weight="100"/>
<font-triplet name="思源宋体" style="normal" weight="200"/>
<font-triplet name="思源宋体" style="normal" weight="300"/>
<font-triplet name="思源宋体" style="normal" weight="400"/>
<font-triplet name="思源宋体" style="normal" weight="500"/>
<font-triplet name="思源宋体" style="normal" weight="600"/>
<font-triplet name="思源宋体" style="normal" weight="700"/>
<font-triplet name="思源宋体" style="normal" weight="800"/>
<font-triplet name="思源宋体" style="normal" weight="900"/>
<font-triplet name="思源宋体" style="italic" weight="100"/>
<font-triplet name="思源宋体" style="italic" weight="200"/>
<font-triplet name="思源宋体" style="italic" weight="300"/>
<font-triplet name="思源宋体" style="italic" weight="400"/>
<font-triplet name="思源宋体" style="italic" weight="500"/>
<font-triplet name="思源宋体" style="italic" weight="600"/>
<font-triplet name="思源宋体" style="italic" weight="700"/>
<font-triplet name="思源宋体" style="italic" weight="800"/>
<font-triplet name="思源宋体" style="italic" weight="900"/>
</font>
</fonts>
</renderer>
</renderers>
</fop>
那如果采用对象模式该如何使用思源宋体哪?
警告如下
遍历字体文件夹
GraphicsEnvironment environment = GraphicsEnvironment.getLocalGraphicsEnvironment();
String[] fontName = environment.getAvailableFontFamilyNames();
for (int i = 0; i < fontName.length; i++) {
System.out.println(fontName[i]);
}
部分结果如下
使用自定义配置即可:
XEasyPdfTemplateDocument document = XEasyPdfTemplateHandler.Document.build().setConfigPath(configPath);
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论