yushkevichv/pdf-cad-reader

解析PDF CAD文件以获取索引元信息和解码的流向量数据

0.3.3 2019-09-18 09:17 UTC

This package is auto-updated.

Last update: 2024-09-18 20:39:29 UTC


README

这是一个独立的PHP库,提供了简单的API来获取PDF文件的常用索引信息以及获取解码的流向量数据。

解析器使用TCPDF库以及来自PDF解析器的通用解析理念和代码

安装

composer require "yushkevichv/pdf-cad-reader"

用法

$pdfReader = new PDFCadReader(); 
$pdfObject = $pdfReader->parseFile($pdfFilePath);

// get common information about pdf file and mappers
$pdfObject->getIndex();

// get array of decodedd streams
$pdfObject->getStreamData();

// decode text from stream
$pdfObject->decodeText('F1', '<02450262026b026c0268025c>');

PDFObject索引结构

[
    'root' ,
    'info' => [
        'width',
        'height',
        'rotate'
    ],
    'mappers' => [
        'layers' => [
            'ocCode' => 'id'  
         ],
        'streams' => [
            'id'
        ],
        'fonts' => [
            'fontCode' => [
                'layer',
                'fontFamily',
                'font' => [
                    'code',
                    'name',
                    'encoding',
                    'type',
                    'flags',
                    'composite',
                    'subType',
                    'fontInfo' => [
                        'fontFamily',
                        'fontWeight',
                        'fontBox' => [],
                        'ascent',
                        'descent',
                        'leading',
                        'capHeight'
                    ],
                    'glyphIndexArray' => [],
    '               'CIDSystemInfo' => [
                        'Registry',
                        'Ordering',
                        'Supplement'
                    ]
                ]
            ]   
        ]
    ],
    'layers' => [
        'id' => 'name'
    ]
]