jorisros/idml-lib

一个用于读取 InDesign IDML 文件的 PHP 库

v0.1 2020-07-18 09:22 UTC

This package is auto-updated.

Last update: 2024-08-29 16:27:47 UTC


README

安装

需求

  • PHP 7.2 或更高版本
  • SimpleXML 扩展

Composer

在您的项目中执行以下命令

composer require jorisros/idml-lib

这会获取最新发布的版本并将其安装到您的 vendor 目录中。

运行示例

在浏览器中显示示例

php -S localhost:3000 -t example/

在浏览器中转到 http://localhost:3000/example_1.php

读取 IDML 文件的示例代码

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

参考文档

IDML

查看更多文档:https://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.173.8853&rep=rep1&type=pdf

或在 docs 目录中。

Relax NG 紧凑语法

https://relaxng.org/compact-tutorial-20030326.html