PHP code example of bitandblack / idml-json-converter

1. Go to this page and download the library: Download bitandblack/idml-json-converter library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

bitandblack / idml-json-converter example snippets

 


use BitAndBlack\IdmlJsonConverter\File\IDML;

$idml = new IDML('/path/to/file.idml');
$idmlContent = $idml->getContent();
 


use BitAndBlack\IdmlJsonConverter\File\JSON;

$content = [
    'mimetype' => 'application/vnd.adobe.indesign-idml-package',
    'designmap.xml' => [
        '@name' => 'Document',
        '@attributes' => [
            'DOMVersion' => 18.0,
            'Self' => 'd',
            'StoryList' => [
                0 => 'ufa',
                1 => 'u126',
                2 => 'u97',
            ],
            'Name' => 'file.indd',
    [...]
];

$json = new JSON($content);
$idmlContent = $json->getIDML();

file_put_contents(
    '/path/to/file.idml',
    $idmlContent
);