@syzlm/ofdparser 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.babelrc +14 -0
- package/.eslintignore +2 -0
- package/.eslintrc.json +18 -0
- package/.prettierrc.json +9 -0
- package/dist/OFD.d.ts +8 -0
- package/dist/Pages.d.ts +7 -0
- package/dist/RootDocumnet.d.ts +1 -0
- package/dist/bundle.cjs.js +64123 -0
- package/dist/bundle.esm.js +64115 -0
- package/dist/bundle.iife.js +14743 -0
- package/dist/bundle.umd.js +64045 -0
- package/dist/constant/index.d.ts +7 -0
- package/dist/constant.d.ts +6 -0
- package/dist/core/ofd-core/Annotations/AnnotationsXml.d.ts +16 -0
- package/dist/core/ofd-core/Asn.1Utils.d.ts +47 -0
- package/dist/core/ofd-core/Documents/DocumentResXml.d.ts +15 -0
- package/dist/core/ofd-core/Documents/DocumnetXml.d.ts +25 -0
- package/dist/core/ofd-core/Documents/PublicResXml.d.ts +15 -0
- package/dist/core/ofd-core/OFDElement.d.ts +232 -0
- package/dist/core/ofd-core/Ofd/OFDXml.d.ts +19 -0
- package/dist/core/ofd-core/Pages/PageXml.d.ts +20 -0
- package/dist/core/ofd-core/Signatures/Signatures.d.ts +20 -0
- package/dist/core/ofd-core/TemplatePages/TemplatePages.d.ts +20 -0
- package/dist/core/ofd-core/constant.d.ts +29 -0
- package/dist/core/ofd-core/utils.d.ts +21 -0
- package/dist/dicom/dicom.d.ts +15 -0
- package/dist/dicom/index.d.ts +1 -0
- package/dist/errors/ErrorHandle.d.ts +6 -0
- package/dist/errors/ErrorMsg.d.ts +16 -0
- package/dist/errors/FetchErrors.d.ts +4 -0
- package/dist/errors/MimeError.d.ts +4 -0
- package/dist/errors/OFDErrors.d.ts +4 -0
- package/dist/errors/UnzipErrors.d.ts +4 -0
- package/dist/errors/XmlErrors.d.ts +4 -0
- package/dist/errors/error-msg.d.ts +9 -0
- package/dist/es.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/lib/ParseFile.d.ts +7 -0
- package/dist/lib/UnitCoversion.d.ts +31 -0
- package/dist/lib/asn1/Asn.1.d.ts +34 -0
- package/dist/lib/asn1/Stream.d.ts +27 -0
- package/dist/lib/asn1/asn1.d.ts +4 -0
- package/dist/lib/asn1/base64.d.ts +4 -0
- package/dist/lib/asn1/hex.d.ts +5 -0
- package/dist/lib/asn1/index.d.ts +5 -0
- package/dist/lib/asn1/int10.d.ts +34 -0
- package/dist/lib/asn1/oids.d.ts +2 -0
- package/dist/lib/asn1/string-cut.d.ts +2 -0
- package/dist/lib/decode-html.d.ts +7 -0
- package/dist/lib/fetch.d.ts +17 -0
- package/dist/lib/is-element.d.ts +5 -0
- package/dist/lib/load-files.d.ts +3 -0
- package/dist/lib/load-opentype.d.ts +34 -0
- package/dist/lib/load-script.d.ts +1 -0
- package/dist/lib/mime.d.ts +8 -0
- package/dist/lib/read-buffer.d.ts +2 -0
- package/dist/lib/toFixeds.d.ts +7 -0
- package/dist/libs/Asn.1Utils.d.ts +47 -0
- package/dist/libs/asn1/Asn.1.d.ts +34 -0
- package/dist/libs/asn1/Stream.d.ts +27 -0
- package/dist/libs/asn1/asn1.d.ts +4 -0
- package/dist/libs/asn1/base64.d.ts +4 -0
- package/dist/libs/asn1/hex.d.ts +5 -0
- package/dist/libs/asn1/index.d.ts +5 -0
- package/dist/libs/asn1/int10.d.ts +34 -0
- package/dist/libs/asn1/oids.d.ts +2 -0
- package/dist/libs/asn1/string-cut.d.ts +2 -0
- package/dist/libs/decode-html.d.ts +7 -0
- package/dist/libs/fetch.d.ts +17 -0
- package/dist/libs/mime.d.ts +8 -0
- package/dist/libs/ofdArray.d.ts +10 -0
- package/dist/libs/ofdImageObject.d.ts +9 -0
- package/dist/libs/ofdLayer.d.ts +3 -0
- package/dist/libs/ofdName.d.ts +17 -0
- package/dist/libs/ofdPathObject.d.ts +11 -0
- package/dist/libs/ofdTextObject.d.ts +6 -0
- package/dist/libs/parseAnnotation.d.ts +5 -0
- package/dist/libs/parseColor.d.ts +5 -0
- package/dist/libs/parsePageArea.d.ts +17 -0
- package/dist/libs/parser-elements.d.ts +8 -0
- package/dist/libs/parserElements.d.ts +8 -0
- package/dist/libs/pipeExtensions.d.ts +4 -0
- package/dist/libs/read-buffer.d.ts +2 -0
- package/dist/main.d.ts +15 -0
- package/dist/ofd/ConverterDpi.d.ts +16 -0
- package/dist/ofd/index.d.ts +1 -0
- package/dist/ofd/ofd-utils.d.ts +137 -0
- package/dist/ofd/ofd.d.ts +35 -0
- package/dist/ofd/parse-ofd.d.ts +18 -0
- package/dist/ofd/render.d.ts +18 -0
- package/dist/ofd/svg-image.d.ts +12 -0
- package/dist/ofd/svg-path.d.ts +5 -0
- package/dist/ofd/svg-text.d.ts +8 -0
- package/dist/ofd.parse.d.ts +6 -0
- package/dist/ofd.xml.d.ts +1 -0
- package/dist/ofdParse.d.ts +6 -0
- package/dist/pipe/annotations.d.ts +13 -0
- package/dist/pipe/attachments.d.ts +13 -0
- package/dist/pipe/commonData.d.ts +18 -0
- package/dist/pipe/customTags.d.ts +14 -0
- package/dist/pipe/extensions.d.ts +14 -0
- package/dist/pipe/output.d.ts +7 -0
- package/dist/pipe/pages.d.ts +13 -0
- package/dist/pipe/permissions.d.ts +14 -0
- package/dist/pipe/pipeline.d.ts +63 -0
- package/dist/pipe/startPipe.d.ts +11 -0
- package/dist/xml/index.d.ts +2 -0
- package/dist/xml/render.d.ts +6 -0
- package/dist/xml/xml.d.ts +18 -0
- package/package.json +47 -0
- package/public/index.html +75 -0
- package/public/opentype.min.js +2 -0
- package/rollup.config.dev.mjs +47 -0
- package/rollup.config.mjs +70 -0
- package/src/constant/index.ts +13 -0
- package/src/core/ofd-core/Annotations/Annotation.km +206 -0
- package/src/core/ofd-core/Annotations/Annotations.km +59 -0
- package/src/core/ofd-core/Annotations/Annotations.md +13 -0
- package/src/core/ofd-core/Annotations/AnnotationsXml.ts +114 -0
- package/src/core/ofd-core/Asn.1Utils.ts +225 -0
- package/src/core/ofd-core/Documents/DocumentResXml.ts +55 -0
- package/src/core/ofd-core/Documents/Documnet.km +862 -0
- package/src/core/ofd-core/Documents/DocumnetXml.ts +118 -0
- package/src/core/ofd-core/Documents/Documnets.md +296 -0
- package/src/core/ofd-core/Documents/PublicResXml.ts +63 -0
- package/src/core/ofd-core/Documents//345/233/276/345/261/202/346/270/262/346/237/223/351/241/272/345/272/217.png +0 -0
- package/src/core/ofd-core/Documents//350/241/25022/347/272/277/346/235/241/350/277/236/346/216/245/346/240/267/345/274/217.png +0 -0
- package/src/core/ofd-core/Documents//350/241/25023/347/272/277/346/235/241/350/231/232/347/272/277/346/240/267/345/274/217.png +0 -0
- package/src/core/ofd-core/Documents//350/241/25023/347/273/223/345/220/210/347/202/271/351/225/277/345/272/246.png +0 -0
- package/src/core/ofd-core/Documents//350/241/25024/347/272/277/346/235/241/347/253/257/347/202/271/346/240/267/345/274/217.png +0 -0
- package/src/core/ofd-core/Documents//351/241/265/350/276/271/347/225/214/345/261/202/346/254/241/347/273/223/346/236/204.png +0 -0
- package/src/core/ofd-core/OFDElement.ts +724 -0
- package/src/core/ofd-core/Ofd/CT_DocInfo.km +197 -0
- package/src/core/ofd-core/Ofd/OFD.km +114 -0
- package/src/core/ofd-core/Ofd/OFD.md +99 -0
- package/src/core/ofd-core/Ofd/OFDXml.ts +69 -0
- package/src/core/ofd-core/Pages/PAGE.md +40 -0
- package/src/core/ofd-core/Pages/PageXml.ts +59 -0
- package/src/core/ofd-core/Signatures/Signature.km +308 -0
- package/src/core/ofd-core/Signatures/Signature.md +21 -0
- package/src/core/ofd-core/Signatures/Signatures.km +315 -0
- package/src/core/ofd-core/Signatures/Signatures.md +24 -0
- package/src/core/ofd-core/Signatures/Signatures.ts +247 -0
- package/src/core/ofd-core/TemplatePages/TemplatePages.ts +56 -0
- package/src/core/ofd-core/asn.md +60 -0
- package/src/core/ofd-core/constant.ts +35 -0
- package/src/core/ofd-core/index.d.ts +867 -0
- package/src/core/ofd-core/utils.ts +86 -0
- package/src/dicom/dicom.ts +42 -0
- package/src/dicom/index.ts +1 -0
- package/src/errors/ErrorHandle.ts +14 -0
- package/src/errors/FetchErrors.ts +8 -0
- package/src/errors/MimeError.ts +9 -0
- package/src/errors/OFDErrors.ts +11 -0
- package/src/errors/UnzipErrors.ts +9 -0
- package/src/errors/XmlErrors.ts +11 -0
- package/src/errors/error-msg.ts +17 -0
- package/src/es.ts +3 -0
- package/src/global.d.ts +7 -0
- package/src/index.ts +7 -0
- package/src/lib/ParseFile.ts +12 -0
- package/src/lib/README.md +69 -0
- package/src/lib/UnitCoversion.ts +55 -0
- package/src/lib/asn1/Asn.1.ts +284 -0
- package/src/lib/asn1/README.md +1 -0
- package/src/lib/asn1/Stream.ts +314 -0
- package/src/lib/asn1/asn1.ts +120 -0
- package/src/lib/asn1/base64.ts +97 -0
- package/src/lib/asn1/hex.ts +60 -0
- package/src/lib/asn1/index.ts +5 -0
- package/src/lib/asn1/int10.ts +103 -0
- package/src/lib/asn1/oids.ts +6164 -0
- package/src/lib/asn1/string-cut.ts +8 -0
- package/src/lib/decode-html.ts +37 -0
- package/src/lib/fetch.ts +70 -0
- package/src/lib/is-element.ts +13 -0
- package/src/lib/jbig/README.md +1 -0
- package/src/lib/jbig/arithmetic_decoder.js +184 -0
- package/src/lib/jbig/base_stream.js +117 -0
- package/src/lib/jbig/ccitt.js +1068 -0
- package/src/lib/jbig/ccitt_stream.js +60 -0
- package/src/lib/jbig/compatibility.js +108 -0
- package/src/lib/jbig/core_utils.js +591 -0
- package/src/lib/jbig/decode_stream.js +184 -0
- package/src/lib/jbig/is_node.js +28 -0
- package/src/lib/jbig/jbig2.js +2582 -0
- package/src/lib/jbig/jbig2_stream.js +78 -0
- package/src/lib/jbig/primitives.js +441 -0
- package/src/lib/jbig/stream.js +101 -0
- package/src/lib/jbig/util.js +1231 -0
- package/src/lib/load-files.ts +26 -0
- package/src/lib/load-opentype.ts +161 -0
- package/src/lib/load-script.ts +33 -0
- package/src/lib/mime.ts +97 -0
- package/src/lib/read-buffer.ts +19 -0
- package/src/lib/toFixeds.ts +56 -0
- package/src/ofd/ConverterDpi.ts +35 -0
- package/src/ofd/OFD.md +38 -0
- package/src/ofd/TODO.md +10 -0
- package/src/ofd/index.ts +1 -0
- package/src/ofd/ofd-utils.ts +627 -0
- package/src/ofd/ofd.demo.md +12 -0
- package/src/ofd/ofd.ts +200 -0
- package/src/ofd/ofdxml.km +162 -0
- package/src/ofd/parse-ofd.ts +103 -0
- package/src/ofd/render.ts +393 -0
- package/src/ofd/svg-image.ts +318 -0
- package/src/ofd/svg-path.ts +283 -0
- package/src/ofd/svg-text.ts +272 -0
- package/src/xml/index.ts +3 -0
- package/src/xml/render.ts +171 -0
- package/src/xml/xml.ts +136 -0
- package/tsconfig.json +21 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ERROR_TYPE_FETCH = "fetch";
|
|
2
|
+
export declare const ERROR_TYPE_UNZIP = "unzip";
|
|
3
|
+
export declare const ERROR_TYPE_MAGIC = "MAGIC";
|
|
4
|
+
export declare const FILE_TYPE_XML = "xml";
|
|
5
|
+
export declare const FILE_TYPE_OFD = "ofd";
|
|
6
|
+
export declare const FILE_TYPE_PDF = "pdf";
|
|
7
|
+
export declare const FILE_TYPE_WORD = "word";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
declare class AnnotationsXml extends OFDElement {
|
|
4
|
+
/**
|
|
5
|
+
* PublicRes.xml文件
|
|
6
|
+
* @date 2022/7/27 - 09:41:22
|
|
7
|
+
*
|
|
8
|
+
* @type {Element[]}
|
|
9
|
+
*/
|
|
10
|
+
static fileName: string;
|
|
11
|
+
constructor(documnetResElements: Element[]);
|
|
12
|
+
formatAnnotationXml(annotFile: Element, annot: any): void;
|
|
13
|
+
setRootPath(annotationsXml: Element, relativePath: string): void;
|
|
14
|
+
setAnnotationsXml(annotationsElements: Element[]): void;
|
|
15
|
+
}
|
|
16
|
+
export default AnnotationsXml;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { ASN1Tag } from '../../lib/asn1/Asn.1';
|
|
2
|
+
import Stream from '../../lib/asn1/Stream';
|
|
3
|
+
interface ASN1 {
|
|
4
|
+
tagLen: number;
|
|
5
|
+
tag: ASN1Tag;
|
|
6
|
+
stream: Stream;
|
|
7
|
+
header: number;
|
|
8
|
+
length: number;
|
|
9
|
+
value: string;
|
|
10
|
+
tagName: string;
|
|
11
|
+
sub: ASN1[] | undefined | null;
|
|
12
|
+
}
|
|
13
|
+
export declare const STATIC_TAG_SEQUENCE = "SEQUENCE";
|
|
14
|
+
export declare const STATIC_TAG_OCTET_STRING = "OCTET_STRING";
|
|
15
|
+
export declare const STATIC_TAG_IA5STRING = "IA5String";
|
|
16
|
+
export declare const STATIC_TAG_INTEGER = "INTEGER";
|
|
17
|
+
/**
|
|
18
|
+
* utf8 string 转Uint8Array
|
|
19
|
+
* @param str
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
export declare function toUint8Arr(str: string): Uint8Array<ArrayBuffer>;
|
|
23
|
+
declare class Asn1Parse {
|
|
24
|
+
static asn1ESealHeader: ASN1;
|
|
25
|
+
static asn1ESealEsID: ASN1;
|
|
26
|
+
static asn1ESealPictureInfo: ASN1;
|
|
27
|
+
static asn1ESealExtDatas: ASN1;
|
|
28
|
+
static asn1ESealProperty: ASN1;
|
|
29
|
+
asn1: string;
|
|
30
|
+
static pricuteInfo: {
|
|
31
|
+
data: Uint8Array | null | string;
|
|
32
|
+
type: string;
|
|
33
|
+
width: string;
|
|
34
|
+
height: string;
|
|
35
|
+
};
|
|
36
|
+
constructor(str: string);
|
|
37
|
+
init(): void;
|
|
38
|
+
decodeUTCTime(str: string): string;
|
|
39
|
+
parsePricuter(ans: ASN1): void;
|
|
40
|
+
getPicture(): {
|
|
41
|
+
type: string;
|
|
42
|
+
data: Uint8Array;
|
|
43
|
+
width: string;
|
|
44
|
+
height: string;
|
|
45
|
+
} | null;
|
|
46
|
+
}
|
|
47
|
+
export default Asn1Parse;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
declare class DocumentResXml extends OFDElement {
|
|
4
|
+
/**
|
|
5
|
+
* DocumentRes xml文件,
|
|
6
|
+
* @date 2022/7/27 - 09:41:22
|
|
7
|
+
*
|
|
8
|
+
* @type {Element[]}
|
|
9
|
+
*/
|
|
10
|
+
static fileName: string;
|
|
11
|
+
constructor(documnetResElements: Element[]);
|
|
12
|
+
setRootPath(documnetResXml: Element): void;
|
|
13
|
+
setDocumnetResXml(documnetResElements: Element[]): void;
|
|
14
|
+
}
|
|
15
|
+
export default DocumentResXml;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import OFDElement from '../OFDElement';
|
|
2
|
+
import PagesXml from '../Pages/PageXml';
|
|
3
|
+
import AnnotationsXml from '../Annotations/AnnotationsXml';
|
|
4
|
+
import TemplatePages from '../TemplatePages/TemplatePages';
|
|
5
|
+
import DocumentResXml from './DocumentResXml';
|
|
6
|
+
import PublicResXml from './PublicResXml';
|
|
7
|
+
declare class DocumnetXml extends OFDElement {
|
|
8
|
+
static fileName: string;
|
|
9
|
+
constructor(fileName: string);
|
|
10
|
+
/**
|
|
11
|
+
* 获取 TemplatePage
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
getTemplatePage(): TemplatePages | null;
|
|
15
|
+
getDocumentRes(): DocumentResXml | null;
|
|
16
|
+
getPublicRes(): PublicResXml | null;
|
|
17
|
+
getPages(): PagesXml | null;
|
|
18
|
+
/**
|
|
19
|
+
* 获取文档区域坐标
|
|
20
|
+
* @returns
|
|
21
|
+
*/
|
|
22
|
+
getPageArea(): null;
|
|
23
|
+
getAnnotation(): AnnotationsXml | null;
|
|
24
|
+
}
|
|
25
|
+
export default DocumnetXml;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
declare class PublicResXml extends OFDElement {
|
|
4
|
+
/**
|
|
5
|
+
* PublicRes.xml文件
|
|
6
|
+
* @date 2022/7/27 - 09:41:22
|
|
7
|
+
*
|
|
8
|
+
* @type {Element[]}
|
|
9
|
+
*/
|
|
10
|
+
static fileName: string;
|
|
11
|
+
constructor(documnetResElements: Element[]);
|
|
12
|
+
setRootPath(publicResXml: Element): void;
|
|
13
|
+
setPublicResXml(publicResElements: Element[]): void;
|
|
14
|
+
}
|
|
15
|
+
export default PublicResXml;
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import { Page, CT_Layer, CT_PageArea, Res, LayerPageBlock, Signatures } from './index.d';
|
|
3
|
+
/**
|
|
4
|
+
* @desc 解析ofd 工具类
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Description placeholder
|
|
8
|
+
* @date 2022/7/22 - 13:29:35
|
|
9
|
+
*
|
|
10
|
+
* @class OFDElement
|
|
11
|
+
* @typedef {OFDElement}
|
|
12
|
+
*/
|
|
13
|
+
export declare class OFDElement {
|
|
14
|
+
/**
|
|
15
|
+
* OFD文件xml合集
|
|
16
|
+
* @date 2022/7/22 - 14:30:53
|
|
17
|
+
*
|
|
18
|
+
* @type {Element}
|
|
19
|
+
*/
|
|
20
|
+
static OFDElements: {
|
|
21
|
+
[key: string]: Element;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* OFDxml转换成json
|
|
25
|
+
* @date 7/25/2022 - 7:42:51 PM
|
|
26
|
+
*
|
|
27
|
+
* @type {(null | { [key: string]: any })}
|
|
28
|
+
*/
|
|
29
|
+
static OFDElemetJSON: null | {
|
|
30
|
+
[key: string]: any;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* OFD文档区域坐标
|
|
34
|
+
* @date 2022/8/1 - 19:01:44
|
|
35
|
+
*
|
|
36
|
+
* @static
|
|
37
|
+
* @type {(null | CT_PageArea)}
|
|
38
|
+
*/
|
|
39
|
+
static PageArea: null | CT_PageArea;
|
|
40
|
+
/**
|
|
41
|
+
* ofd page数组
|
|
42
|
+
* @date 2022/7/26 - 17:17:13
|
|
43
|
+
*
|
|
44
|
+
* @type {(null | Page)}
|
|
45
|
+
*/
|
|
46
|
+
static Pages: null | Page[];
|
|
47
|
+
/**
|
|
48
|
+
* ofd Tpls 对象
|
|
49
|
+
* @date 2022/7/26 - 17:17:13
|
|
50
|
+
*
|
|
51
|
+
* @type {(null | Tpls)}
|
|
52
|
+
*/
|
|
53
|
+
static Tpls: null | {
|
|
54
|
+
[k: string]: Page[];
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* DocumnetRes.xml、PublicRes.xml 解析合并生成数组
|
|
58
|
+
* @date 2022/8/1 - 13:24:15
|
|
59
|
+
*
|
|
60
|
+
* @static
|
|
61
|
+
* @type {(null|Res[])}
|
|
62
|
+
*/
|
|
63
|
+
static Res: null | Res[];
|
|
64
|
+
/**
|
|
65
|
+
* 签章信息
|
|
66
|
+
* @date 2022/8/19 - 10:27:27
|
|
67
|
+
*
|
|
68
|
+
* @static
|
|
69
|
+
* @type {(null | Signatures[])}
|
|
70
|
+
*/
|
|
71
|
+
static Signatures: null | Signatures[];
|
|
72
|
+
static PageSignatures: null | {
|
|
73
|
+
[key: string]: Signatures[];
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* documnetRes资源文件路径
|
|
77
|
+
* @date 2022/8/1 - 15:18:10
|
|
78
|
+
*
|
|
79
|
+
* @static
|
|
80
|
+
* @type {string}
|
|
81
|
+
*/
|
|
82
|
+
static DocumnetResRoot: string;
|
|
83
|
+
/**
|
|
84
|
+
* PublicRes资源文件路径
|
|
85
|
+
* @date 2022/8/1 - 15:18:10
|
|
86
|
+
*
|
|
87
|
+
* @static
|
|
88
|
+
* @type {string}
|
|
89
|
+
*/
|
|
90
|
+
static PublicResRoot: string;
|
|
91
|
+
/**
|
|
92
|
+
* AnnotationsRoot 文件路径
|
|
93
|
+
* @date 2023/8/7 - 14:23:52
|
|
94
|
+
*
|
|
95
|
+
* @static
|
|
96
|
+
* @type {string}
|
|
97
|
+
*/
|
|
98
|
+
static AnnotationsRoot: string;
|
|
99
|
+
/**
|
|
100
|
+
* OFDxml转换成json 平级
|
|
101
|
+
* @date 7/25/2022 - 7:42:51 PM
|
|
102
|
+
*
|
|
103
|
+
* @type {(null | { [key: string]: any })}
|
|
104
|
+
*/
|
|
105
|
+
static OFDElemetFlatJSON: null | {
|
|
106
|
+
[key: string]: any;
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* 根目录地址 以"/"结尾
|
|
110
|
+
* @date 2022/7/27 - 16:00:31
|
|
111
|
+
*
|
|
112
|
+
* @static
|
|
113
|
+
* @type {string}
|
|
114
|
+
*/
|
|
115
|
+
static STLoc: string;
|
|
116
|
+
constructor(ofdXML?: {
|
|
117
|
+
[key: string]: Element;
|
|
118
|
+
});
|
|
119
|
+
/**
|
|
120
|
+
* @desc 初始化
|
|
121
|
+
*/
|
|
122
|
+
static init(): void;
|
|
123
|
+
/**
|
|
124
|
+
* @desc 设置文档根目录名称
|
|
125
|
+
*/
|
|
126
|
+
setST_Loc(str: string): void;
|
|
127
|
+
/**
|
|
128
|
+
*
|
|
129
|
+
* @param name 节点名称
|
|
130
|
+
* @returns ofd:xxx
|
|
131
|
+
*/
|
|
132
|
+
OFDCommonQName(name: string): string;
|
|
133
|
+
/**
|
|
134
|
+
* 获取指定文件xml
|
|
135
|
+
* @param name
|
|
136
|
+
* @param fileName
|
|
137
|
+
* @returns
|
|
138
|
+
*/
|
|
139
|
+
getElements(name: string, fileName: string): string;
|
|
140
|
+
/**
|
|
141
|
+
* 格式化xml文件
|
|
142
|
+
* @param ofdXml
|
|
143
|
+
*/
|
|
144
|
+
XmlChangeJson(xmlKey: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* 获取OFD的元素
|
|
147
|
+
* <p>
|
|
148
|
+
* 若无法在OFD命名空间下获取同名元素,则尝试从默认命名空间获取。
|
|
149
|
+
*
|
|
150
|
+
* @param name OFD元素名称
|
|
151
|
+
* @return OFD元素或null
|
|
152
|
+
*/
|
|
153
|
+
getOFDElements(fileName: string, name: string): Element | null;
|
|
154
|
+
/**
|
|
155
|
+
* 获取OFD的元素
|
|
156
|
+
* <p>
|
|
157
|
+
* 若无法在OFD命名空间下获取同名元素,则尝试从默认命名空间获取。
|
|
158
|
+
* 无法获取同名数据
|
|
159
|
+
* @param name OFD元素名称
|
|
160
|
+
* @return OFD元素或null
|
|
161
|
+
*/
|
|
162
|
+
getJSONElement(elements: Element[]): {
|
|
163
|
+
[k: string]: string;
|
|
164
|
+
} | null;
|
|
165
|
+
/**
|
|
166
|
+
* 获取OFD元素中的文本
|
|
167
|
+
*
|
|
168
|
+
* @param elements 元素节点
|
|
169
|
+
* @return 文本
|
|
170
|
+
*/
|
|
171
|
+
getOFDElementText(elements: Element[] | null, fileName?: string): {
|
|
172
|
+
[k: string]: unknown;
|
|
173
|
+
};
|
|
174
|
+
getPageAction(): void;
|
|
175
|
+
getPageRes(): void;
|
|
176
|
+
/**
|
|
177
|
+
* @description 递归获取剪裁区域信息
|
|
178
|
+
*/
|
|
179
|
+
getClipsObject(elements: Element[], cInfo: {
|
|
180
|
+
[k: string]: string | {
|
|
181
|
+
[k: string]: string;
|
|
182
|
+
};
|
|
183
|
+
}): {
|
|
184
|
+
[k: string]: string | {
|
|
185
|
+
[k: string]: string;
|
|
186
|
+
};
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* 获取TextObject、ImageObject、PathObject
|
|
190
|
+
*/
|
|
191
|
+
getLayerObject(elements: Element[]): {
|
|
192
|
+
[k: string]: unknown;
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* 获取layer节点信息
|
|
196
|
+
* @param elements
|
|
197
|
+
* @returns
|
|
198
|
+
*/
|
|
199
|
+
getPageBlock(elements: Element[]): LayerPageBlock[] & {
|
|
200
|
+
[k: string]: unknown;
|
|
201
|
+
}[];
|
|
202
|
+
/**
|
|
203
|
+
* 获取Content下Layer,多个Layer 合并进入数组
|
|
204
|
+
* @param elements
|
|
205
|
+
* @returns [{Type:'ImageObject'|'TextObject'|'PathObject',ID:'',Boundary:'', }]
|
|
206
|
+
*/
|
|
207
|
+
getPageContent(elements: Element[]): CT_Layer[];
|
|
208
|
+
/**
|
|
209
|
+
* 获取ofd:Page Elemnet数据
|
|
210
|
+
* @param pageElement ofd:Page节点
|
|
211
|
+
* @param type 类型 page|template type=template:不返回 Template
|
|
212
|
+
* @return
|
|
213
|
+
* ```{Area: CT_PageArea;Content: PageLayer[];Template?: Template;}```
|
|
214
|
+
*/
|
|
215
|
+
getPageAttr(pageElement: Element, type?: string): Page & {
|
|
216
|
+
[k: string]: any;
|
|
217
|
+
};
|
|
218
|
+
setTpls(tplElement: Element, tplId: string): void;
|
|
219
|
+
/**
|
|
220
|
+
* @desc 设置Pages
|
|
221
|
+
* @param pageElements
|
|
222
|
+
*/
|
|
223
|
+
setPages(pageElement: Element & {
|
|
224
|
+
PageID: string;
|
|
225
|
+
}): void;
|
|
226
|
+
/**
|
|
227
|
+
* 设置资源内容
|
|
228
|
+
* @param documnetResXml
|
|
229
|
+
*/
|
|
230
|
+
setRes(resElement: Element[], rootPath: string): void;
|
|
231
|
+
}
|
|
232
|
+
export default OFDElement;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
import DocumnetXml from '../Documents/DocumnetXml';
|
|
4
|
+
import SignaturesXml from '../Signatures/Signatures';
|
|
5
|
+
import { ResultData } from '..';
|
|
6
|
+
declare class OFDXMl extends OFDElement {
|
|
7
|
+
static fileName: string;
|
|
8
|
+
constructor(ofdxml: {
|
|
9
|
+
[key: string]: Element;
|
|
10
|
+
});
|
|
11
|
+
getDocument(): DocumnetXml | null;
|
|
12
|
+
getSignatures(): SignaturesXml | null;
|
|
13
|
+
/**
|
|
14
|
+
* 将OFD文件XML转换成渲染获取可操作数据
|
|
15
|
+
* @returns ResultData
|
|
16
|
+
*/
|
|
17
|
+
getData(): ResultData;
|
|
18
|
+
}
|
|
19
|
+
export default OFDXMl;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
declare class PagesXml extends OFDElement {
|
|
4
|
+
/**
|
|
5
|
+
* Pages xml文件,以数组存放,存在多页
|
|
6
|
+
* @date 2022/7/27 - 09:41:22
|
|
7
|
+
*
|
|
8
|
+
* @type {Element[]}
|
|
9
|
+
*/
|
|
10
|
+
pagesXml: (Element & {
|
|
11
|
+
PageID: string;
|
|
12
|
+
})[];
|
|
13
|
+
static fileName: string;
|
|
14
|
+
constructor(pagesElements: Element[]);
|
|
15
|
+
formatPageXml(pagesFile: (Element & {
|
|
16
|
+
PageID: string;
|
|
17
|
+
})[]): void;
|
|
18
|
+
setPagesXml(pageElements: Element[]): void;
|
|
19
|
+
}
|
|
20
|
+
export default PagesXml;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
import { Seal, Signature, Signatures, SignedInfo } from '../index.d';
|
|
4
|
+
declare class SignaturesXml extends OFDElement {
|
|
5
|
+
static fileName: string;
|
|
6
|
+
static Signatures: Signatures[];
|
|
7
|
+
signedPath: string;
|
|
8
|
+
constructor(fileName: string);
|
|
9
|
+
getDocumentRes(): void;
|
|
10
|
+
getPublicRes(): null;
|
|
11
|
+
getSeal(filePath: string): Seal;
|
|
12
|
+
getSignedInfo(signedInfoElement: Element[]): SignedInfo;
|
|
13
|
+
getSignature(filePath: string): Signature | null;
|
|
14
|
+
/**
|
|
15
|
+
* 获取文档区域坐标
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
getSignatures(): null;
|
|
19
|
+
}
|
|
20
|
+
export default SignaturesXml;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
import OFDElement from '../OFDElement';
|
|
3
|
+
declare class TemplatePages extends OFDElement {
|
|
4
|
+
/**
|
|
5
|
+
* TemplatePages 文件,以数组存放,存在多页
|
|
6
|
+
* @date 2022/7/27 - 09:41:22
|
|
7
|
+
*
|
|
8
|
+
* @type {Element[]}
|
|
9
|
+
*/
|
|
10
|
+
tplsXml: {
|
|
11
|
+
[k: string]: Element;
|
|
12
|
+
} | null;
|
|
13
|
+
static fileName: string;
|
|
14
|
+
constructor(tplsElements: Element[]);
|
|
15
|
+
formatTplsXml(tplsFile: {
|
|
16
|
+
[k: string]: Element;
|
|
17
|
+
}): void;
|
|
18
|
+
setTplsXml(tplsElements: Element[]): void;
|
|
19
|
+
}
|
|
20
|
+
export default TemplatePages;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 命名空间 URI,《GB/T_33190-2016》 7.1 命名空间
|
|
3
|
+
*/
|
|
4
|
+
export declare const OFD_NAMESPACE_URI: string;
|
|
5
|
+
/**
|
|
6
|
+
* 元素节点应使用命名空间标识符
|
|
7
|
+
* ————《GB/T 33190-2016》 7.1 命名空间
|
|
8
|
+
*/
|
|
9
|
+
export declare const OFD_VALUE: string;
|
|
10
|
+
/**
|
|
11
|
+
* OFD命名空间
|
|
12
|
+
*/
|
|
13
|
+
export declare const OFD_Q: string;
|
|
14
|
+
/**
|
|
15
|
+
* OFD地址前缀 DOC_0/
|
|
16
|
+
*/
|
|
17
|
+
export declare const OFD_PATH: string;
|
|
18
|
+
/**
|
|
19
|
+
* xs:date 类型日期格式化
|
|
20
|
+
*/
|
|
21
|
+
export declare const DATE_FORMATTER: string;
|
|
22
|
+
/**
|
|
23
|
+
* xs:dateTime 类型时间日期格式化
|
|
24
|
+
*/
|
|
25
|
+
export declare const DATETIME_FORMATTER: string;
|
|
26
|
+
/**
|
|
27
|
+
* OFD索引文件
|
|
28
|
+
*/
|
|
29
|
+
export declare const INDEX_FILE: string;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Element } from 'xml-js';
|
|
2
|
+
export declare const reHex: RegExp;
|
|
3
|
+
export declare function recursion(elements: Array<Element>, result: {
|
|
4
|
+
[key: string]: any;
|
|
5
|
+
}, flatResult: {
|
|
6
|
+
[key: string]: any;
|
|
7
|
+
}): void;
|
|
8
|
+
export declare function recursionGet(elements: Array<Element>, qName: string): Element | null;
|
|
9
|
+
export declare const NameREG: RegExp;
|
|
10
|
+
/**
|
|
11
|
+
* @description
|
|
12
|
+
* 包结构内文件的路径,“”表示当前路径,“”表示父路径。
|
|
13
|
+
* 约定:
|
|
14
|
+
* 1.“/”代表根节点;
|
|
15
|
+
* 2. 未显式指定时代表当前路径;
|
|
16
|
+
* 3.路径区分大小写
|
|
17
|
+
* @param STLoc
|
|
18
|
+
* @param pathString
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare const replacePathPriex: (STLoc: string, pathString: string) => string;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface Options {
|
|
2
|
+
file: string | File | ArrayBuffer;
|
|
3
|
+
container?: Element;
|
|
4
|
+
requestOptions?: undefined | {
|
|
5
|
+
[key: string]: any;
|
|
6
|
+
};
|
|
7
|
+
requestData?: undefined | {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
};
|
|
10
|
+
responseFilter?: (key: {
|
|
11
|
+
[key: string]: string | number;
|
|
12
|
+
}) => string;
|
|
13
|
+
}
|
|
14
|
+
declare const parse: ({ file }: Options) => void;
|
|
15
|
+
export default parse;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './dicom';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
interface ErrorMsg {
|
|
2
|
+
400: string;
|
|
3
|
+
403: string;
|
|
4
|
+
404: string;
|
|
5
|
+
500: string;
|
|
6
|
+
9999: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const ERROR_TYPE_FETCH = "fetch";
|
|
9
|
+
export declare const ERROR_TYPE_UNZIP = "unzip";
|
|
10
|
+
export declare const ERROR_TYPE_MAGIC = "MAGIC";
|
|
11
|
+
export declare const FILE_TYPE_XML = "xml";
|
|
12
|
+
export declare const FILE_TYPE_OFD = "ofd";
|
|
13
|
+
export declare const FILE_TYPE_PDF = "pdf";
|
|
14
|
+
export declare const FILE_TYPE_WORD = "word";
|
|
15
|
+
declare const errorMsg: ErrorMsg;
|
|
16
|
+
export default errorMsg;
|
package/dist/es.d.ts
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @desc mm 转 px
|
|
3
|
+
*/
|
|
4
|
+
declare class UnitCoversion {
|
|
5
|
+
/**
|
|
6
|
+
* Description placeholder
|
|
7
|
+
* @date 2022/8/2 - 15:49:57
|
|
8
|
+
*
|
|
9
|
+
* @static
|
|
10
|
+
* @type {number}
|
|
11
|
+
*/
|
|
12
|
+
static multiple: number;
|
|
13
|
+
/**
|
|
14
|
+
* 设置1mm单位
|
|
15
|
+
*/
|
|
16
|
+
setUnit(): void;
|
|
17
|
+
/**
|
|
18
|
+
* px转换MM
|
|
19
|
+
* @param millimeter 待转换毫米
|
|
20
|
+
* @returns number
|
|
21
|
+
*/
|
|
22
|
+
CoversionMill(px: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* 毫米转换PX
|
|
25
|
+
* @param millimeter 待转换毫米
|
|
26
|
+
* @returns number
|
|
27
|
+
*/
|
|
28
|
+
CoversionPx(millimeter: number | string): number;
|
|
29
|
+
}
|
|
30
|
+
declare const _default: UnitCoversion;
|
|
31
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import Stream from './Stream';
|
|
2
|
+
export declare class ASN1Tag {
|
|
3
|
+
tagClass: number;
|
|
4
|
+
tagNumber: number;
|
|
5
|
+
tagConstructed: boolean;
|
|
6
|
+
constructor(stream: Stream);
|
|
7
|
+
isUniversal(): boolean;
|
|
8
|
+
isEOC(): boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare class Asn1 {
|
|
11
|
+
stream: {
|
|
12
|
+
[k: string | number]: any;
|
|
13
|
+
};
|
|
14
|
+
header: number;
|
|
15
|
+
length: number;
|
|
16
|
+
tag: ASN1Tag;
|
|
17
|
+
tagLen: number;
|
|
18
|
+
sub: any[];
|
|
19
|
+
constructor(stream: {
|
|
20
|
+
[k: string | number]: any;
|
|
21
|
+
}, header: number, length: number, tag: ASN1Tag, tagLen: number, sub: any[]);
|
|
22
|
+
typeName(): string | undefined;
|
|
23
|
+
content(maxLength?: number): any;
|
|
24
|
+
toString(): string;
|
|
25
|
+
toPrettyString(indent: any): string;
|
|
26
|
+
posStart(): any;
|
|
27
|
+
posContent(): any;
|
|
28
|
+
posEnd(): any;
|
|
29
|
+
/** Position of the length. */
|
|
30
|
+
posLen(): any;
|
|
31
|
+
toHexString(): any;
|
|
32
|
+
toB64String(): any;
|
|
33
|
+
}
|
|
34
|
+
export default Asn1;
|