jorisros / idml-lib
A php library to read Indesign IDML files
Installs: 554
Dependents: 0
Suggesters: 0
Security: 0
Stars: 35
Watchers: 4
Forks: 11
Open Issues: 1
Requires (Dev)
- phan/phan: ^3.1
- phpunit/phpunit: ^9.2
- squizlabs/php_codesniffer: ^3.5
This package is auto-updated.
Last update: 2024-10-29 16:47:53 UTC
README
Installation
Requirements
- PHP 7.2 or higher
- SimpleXML extension
Composer
Inside your project execute the following command
composer require jorisros/idml-lib
This got the latest released version and installed it into your vendor directory.
Run example
Show example in browser
php -S localhost:3000 -t example/
Go in your browser to http://localhost:3000/example_1.php
Example code for reading a IDML file
<?php
// Load library
require_once __DIR__ . '/../vendor/autoload.php';
// Location of IDML file
$file = new \JorisRos\IDMLlib\IDMLfile('../tests/assets/example.idml');
$idml = new \JorisRos\IDMLlib\IDMLlib($file);
// Recieve tags from who are defined in Indesign
$tags = $idml->getContentTags();
// Read content from tag `dynamic_content`
$content = $idml->getContentByTagName('dynamic_content');
echo $content;
// Idea for how it should be working in the future, for creating personalized content
$idml = new \JorisRos\IDMLlib\IDMLlib($file);
$masterSpread = $idml->getMasterSpread();
$idml->addPage($masterSpread, ['tag', 'Tag replace content']);
$idml->saveAs('/tmp/test.idml');
Reference documentation
IDML
See more documentation: https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.173.8853&rep=rep1&type=pdf
Or in the docs
directory.