pdfmake-RTL (英语)

PDFMake RTL 软件 是增强版本的 PDF 制作 与 自动 RTL( 右到左) 语言支持 用于阿拉伯语,波斯语(法尔西语),乌尔都语等RTL文字. 不需要手动配置——只需写出您的内容和库自动检测和处理RTL文本!
所有已存在的PDFMake代码工作不变,添加了自动RTL支持!
重要内容: 此软件包已移至一个新的 npm 范围 。 请使用
pdfmake-rtl继续前进.npm install pdfmake-rtl
关键特性
- ✅ 自动 RTL 检测 - 不用设了
rtl旗帜 - ✅ 智能表格列倒转 - 阿拉伯文/佩斯文/乌尔都文表格自动倒行
- ✅ Unicode 脚本检测 - 支持阿拉伯语、波斯语、乌尔都语和扩展语
- ✅ 自动选择字体 - 每种语言使用适当的字体
- ✅ 适当的文本对齐 - RTL 文本对右, LTR 文本对左
- ✅ 列表项目符号位置 - 为RTL清单正确定位的子弹
- ✅ 混合内容支持 - 阿拉伯语/波斯语/乌尔都语/英语混合内容
- ✅ 100% PDF 制作兼容性 - 用于PDFMake的投放替换
现场直播
PDF 文件生成库,用于纯JavaScript中的服务器侧和客户端侧.
检查出来 游乐场 财务报告和审定财务报表 实例。 。 。 .
文档
综合指南、API参考文献和使用实例,请访问 pdfmake.github.io/docs (英语)。 。 。 .
特征
RTL 语言支持
- 自动RTL 检测 阿拉伯语、波斯语(法尔西语)、乌尔都语和其他RTL 脚本
- 智能表格列倒转 ——列自动反转RTL内容
- 自动选择字体 ——阿拉伯语,波斯语和乌尔都语文本使用开罗字体
- 适当的文本对齐 — RTL 文本自动向右对齐, LTR 向左对齐
- 列出弹出位置 - 为RTL清单正确定位了子弹和数字
- 混合内容处理 ——在同一文件中无缝处理阿拉伯语/波斯语/乌尔都语/英语
- Unicode 脚本检测 ——支持阿拉伯语,波斯语,乌尔都语字符和扩展名
支持的RTL语言
| 语言 | 脚本 | 自动字体 |
|---|---|---|
| 阿拉伯语 | العربية | 开罗 |
| 波斯语( 法尔西 ) | فارسی | 开罗 |
| 乌尔都语 | اردو | 开罗 |
| 其他RTL 脚本 | —— 说 | 开罗 |
一般特点
- 线接,
- 文本对齐(左,右,中,正),
- 编号和中弹清单(带有RTL-感应子弹定位),
- 表格和栏
- 自动/固定/星等宽度,
- 相声和相声,
- 页面断开时自动重复页眉,
- rTL 内容的自动列反转, (中文(简体) ),
- 图像和向量图形,
- 方便的造型和风格的继承,
- 页面页眉和页脚 :
- 静态或动态内容,
- 访问当前页码和页数,
- 背景层,
- 页面尺寸和方向,
- 边距,
- 文件节,
- 自定义分页符,
- 字体嵌入(包含用于 RTL 支持的开罗字体),
- 支持复杂、多层次(取消)结构,
- 目录,
- 打开/打印/下载生成的 PDF 的帮助方法,
- 设置 PDF 元数据(例如作者,主题).
* 安装
npm install pdfmake-rtl
QQ快起步-浏览器 (Client-Side)
<!-- Load pdfmake-rtl + fonts -->
<script src="https://unpkg.com/pdfmake-rtl/build/pdfmake.min.js"></script>
<script src="https://unpkg.com/pdfmake-rtl/build/vfs_fonts.js"></script>
<!-- <script src="https://unpkg.com/pdfmake-rtl/build/fonts/Cairo.js"></script> -->
<script>
var dd = {
rtl: true,
// If Cairo font isn't applied automatically, set `rtl: true` to force RTL mode or add defaultStyle:{font:'Cairo'}
content: [
// RTL paragraph — auto-detected, no configuration needed
{ text: "مرحباً بكم في مكتبة pdfmake-rtl", fontSize: 20, bold: true },
{
text: "هذه المكتبة تدعم اللغة العربية تلقائياً",
margin: [0, 0, 0, 15],
},
// RTL table — columns auto-reverse for Arabic content
{
table: {
// rtl:true
widths: ["*", "*", "*"],
body: [
[
{ text: "الراتب", bold: true },
{ text: "القسم", bold: true },
{ text: "الاسم", bold: true },
],
["5000", "تكنولوجيا", "أحمد محمد"],
["6000", "تسويق", "فاطمة علي"],
],
},
},
// Force RTL on any table with rtl: true
{
table: {
rtl: true,
widths: ["*", "*", "*"],
body: [
[
{ text: "Status", bold: true },
{ text: "Name", bold: true },
{ text: "#", bold: true },
],
["Active", "Ali Hassan", "1"],
["Active", "Sara Ahmed", "2"],
],
},
},
],
};
pdfMake.createPdf(dd).open();
</script>
* 参看完整的实例:
examples/simple-rtl-table.html
QQ快起步-节点.js (Server-Side)
var pdfmake = require("pdfmake-rtl");
// Add fonts
// Cairo is the default font for RTL languages (Arabic, Persian, Urdu)
// Roboto is the default font for LTR/Latin text
var Roboto = require("pdfmake-rtl/fonts/Roboto");
pdfmake.addFonts(Roboto);
var Cairo = require("pdfmake-rtl/fonts/Cairo");
pdfmake.addFonts(Cairo);
var dd = {
// If Cairo font isn't applied automatically, set `rtl: true` to force RTL mode or add defaultStyle Cairo
rtl: true, // Forces RTL layout direction for the entire document
content: [
{ text: "مرحباً بكم في مكتبة pdfmake-rtl", fontSize: 20, bold: true },
{
table: {
widths: ["*", "*", "*"],
body: [
[
{ text: "الراتب", bold: true },
{ text: "القسم", bold: true },
{ text: "الاسم", bold: true },
],
["5000", "تكنولوجيا", "أحمد محمد"],
["6000", "تسويق", "فاطمة علي"],
],
},
},
],
};
var pdf = pdfmake.createPdf(dd);
pdf.write("output.pdf").then(() => console.log("PDF created!"));
文档
文档 URL: https://pdfmake-trtl.github.io/docs/* (中文(简体) )* 联合国
文件来源: https://github.com/pdfmake-trtl/docs (中文(简体) ) 欢迎改进!
来源建筑
使用 npm :
git clone https://github.com/aysnet1/pdfmake-rtl.git
cd pdfmake-rtl
npm install
npm run build
使用线条 :
git clone https://github.com/aysnet1/pdfmake-rtl.git
cd pdfmake-rtl
yarn
yarn run build
许可证
麻省理工学院
贷项
pdf make-rtl 页面存档备份,存于互联网档案馆
- @aysnet1 (英语) — 创建者和维护者
pdfmake(原始图书馆)
- @bpampuch (英语) ——创始人
- @liborm85 (英语) - 维护者
pdfmake 是基于一个真正惊人的库 pdfkit (英语) (对 @devongovett (英语)) (中文(简体) ).
感谢所有贡献者.