yushkevichv/pdf-cad-reader

Parse PDF CAD files for get index meta info and decoded stream vector data

0.3.3 2019-09-18 09:17 UTC

This package is auto-updated.

Last update: 2024-10-18 20:53:48 UTC


README

It is standalone PHP Library, provide simple API for get common index information about PDF file and get decoded stream vecctor data.

Parser use TCPDF library and common parsing ideas and code from PDF Parser

Install

composer require "yushkevichv/pdf-cad-reader"

Usage

$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>');

Structure of PDFObject Index

[
    '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'
    ]
]