Skip to content

Commit

Permalink
Merge pull request #1 from SignitDoc/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
xxss0903 authored Nov 27, 2024
2 parents 7dd8075 + 68b4e43 commit 3e85cf6
Show file tree
Hide file tree
Showing 56 changed files with 1,059 additions and 2,179 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
# LiteOfd 类方法说明文档

版本:0.1.1
版本:0.2.5

## 1. 简介

LiteOfd 是一个用于处理 OFD(Open Fixed-layout Document)文件的轻量级库。它提供了解析、渲染和操作 OFD 文档的功能,使开发者能够在 Web 应用中轻松展示和操作 OFD 文档。<br>

## 在线演示

🔗 **Demo**: [https://signitdoc.github.io/liteofd/](https://signitdoc.github.io/liteofd/)

## 1.1示例图片

以下是一个OFD文档渲染的示例图片:
Expand All @@ -23,9 +27,14 @@ LiteOfd 是一个用于处理 OFD(Open Fixed-layout Document)文件的轻量
npm install liteofd
```

`注意:目前打包遇到问题,发布到npm之后字体文件因为无法正确加载导致渲染字体可能出现问题,所以建议源码引入。另外如果有人愿意贡献打包脚本,可以联系我。QQ:897761547,谢谢!或者帮忙修改打包脚本,提PR。`

步骤是将OFD文档解析之后调用渲染方法,然后将渲染结果添加到显示组件中
```Typescript
import { LiteOfd } from 'liteofd'

function parseOfdFile(file: File) {
const liteOfd = new LiteOfd()
let appContent = getElementById("ofd-content")
appContent.innerHTML = ''
liteOfd.parse(file).then((data: OfdDocument) => {
Expand Down
Binary file removed docs/assets/ArialMT-DyOflV0j.ttf
Binary file not shown.
Binary file removed docs/assets/FangSong_GB2312-CpBdDyuD.otf
Binary file not shown.
Binary file removed docs/assets/Nsimsun-cXRvCkmd.ttf
Binary file not shown.
Binary file removed docs/assets/SIMFANG-CwNyEwdc.TTF
Binary file not shown.
Binary file removed docs/assets/Times-Bold-SsrNQBCi.otf
Binary file not shown.
12 changes: 6 additions & 6 deletions src/main.ts → example/main.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './style.css'
import LiteOfd from "./liteofd/liteOfd"
import { XmlData } from './liteofd/ofdData';
import * as parser from './liteofd/parser'
import { AttributeKey, OFD_KEY } from './liteofd/attrType';
import {OfdDocument} from "./liteofd/ofdDocument.ts";
import { OfdTools } from './liteofd/ofdtools';
import LiteOfd from "../src/liteofd/liteOfd.ts"
import { XmlData } from '../src/liteofd/ofdData.ts';
import * as parser from '../src/liteofd/parser.ts'
import { AttributeKey, OFD_KEY } from '../src/liteofd/attrType.ts';
import {OfdDocument} from "../src/liteofd/ofdDocument.ts";
import { OfdTools } from '../src/liteofd/ofdtools.ts';
import { ChildProcess } from 'child_process';

const appContent = document.getElementById('content') as HTMLDivElement
Expand Down
File renamed without changes.
10 changes: 5 additions & 5 deletions src/tools.ts → example/tools.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { AttributeKey, OFD_KEY } from './liteofd/attrType';
import LiteOfd from './liteofd/liteOfd';
import { XmlData } from './liteofd/ofdData';
import { OfdDocument } from './liteofd/ofdDocument';
import { findAttributeValueByKey, findValueByTagName } from './liteofd/parser';
import { AttributeKey, OFD_KEY } from '../src/liteofd/attrType';
import LiteOfd from '../src/liteofd/liteOfd';
import { XmlData } from '../src/liteofd/ofdData';
import { OfdDocument } from '../src/liteofd/ofdDocument';
import { findAttributeValueByKey, findValueByTagName } from '../src/liteofd/parser';

let selectedFile: File | null = null;

Expand Down
12 changes: 6 additions & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@
<style>
@font-face {
font-family: 'Times-Bold';
src: url('public/assets/Times-Bold.otf');
src: url('public/assets/fonts/Times-Bold.otf');
}
@font-face {
font-family: 'NSimSun';
src: url('public/assets/Nsimsun.ttf');
src: url('public/assets/fonts/Nsimsun.ttf');
}
@font-face {
font-family: 'FangSong_GB2312';
src: url('public/assets/FangSong_GB2312.otf');
src: url('public/assets/fonts/FangSong_GB2312.otf');
}
@font-face {
font-family: 'SimFang';
src: url('public/assets/SIMFANG.TTF');
src: url('public/assets/fonts/SIMFANG.TTF');
}
@font-face {
font-family: 'ArialMT';
src: url('public/assets/ArialMT.ttf');
src: url('public/assets/fonts/ArialMT.ttf');
}
</style>
</head>
Expand Down Expand Up @@ -89,6 +89,6 @@
<div id="overlay" class="overlay"></div>
<div id="signature-details" class="signature-details"></div>
</div>
<script type="module" src="/src/main.ts"></script>
<script type="module" src="/example/main.ts"></script>
</body>
</html>
39 changes: 0 additions & 39 deletions index.ts

This file was deleted.

109 changes: 0 additions & 109 deletions local_modules/@lapo/asn1js/package.json

This file was deleted.

Loading

0 comments on commit 3e85cf6

Please sign in to comment.