Developing with PimPrint

This chapter gives a quick introduction to implement InDesign document generation with PimPrint:

Start developing

To start developing with PimPrint good entry points are the fully documented example projects provided with the PimPrint-Demo. Start with the demo rendering Services and perhaps step through them with a debugger.

For a full documented demo of all Rendering Commands refer to the Command demos classes also included in PimPrint-Demo.

REST API

PimPrint InDesign plugin communicates with the server over a REST API.

All endpoints are implemented in \Mds\PimPrint\CoreBundle\Controller\InDesignController which exposes this endpoint routes:

mds_pimprint_core_indesign_projects 		/pimprint-api/projects
mds_pimprint_core_indesign_project     		/pimprint-api/project/{identifier}
mds_pimprint_core_indesign_executeproject 	/pimprint-api/project/{identifier}/run
mds_pimprint_custom_search                      /pimprint-api/project/{identifier}/custom-search/{customField}

As PimPrint uses Pimcore User logins for securing access and uses the Pimcore Users and Roles for data access permissions an active Pimcore backend login session is required when accessing the REST API. Therefore, you have to authenticate with the Pimcore backend first when accessing the REST API with a browser.

REST API - Pimcore authentication

Debugging

To debug, and step analyse the demos and your own projects, you can set your Xdebug extension to autostart on every request by editing your php.ini enabling direct debugging from InDesign.

;XDebug v2.x
xdebug.remote_autostart = 1

;XDebug v3.x
xdebug.start_with_request = yes

The more convenience way is to access the REST API endpoints directly in a browser and start the debugging session. Note that an active Pimcore backend login session is required as noted above.

PimPrint with HTTP Proxy

By default, PimPrint downloads template and asset files directly from the Pimcore server over HTTP(S) and builds the protocol, hostname and port automatically. In some circumstances this can fail when Pimcore is running behind an HTTP Proxy and leads to download errors like:

AssetDownloader Template Error:
connect ETIMEDOUT 127.0.0.1:8017
http://pimprint-demo.dev:8017/…/PimPrint-DataPrintDemo_blue.indd

For such environments mds_pimprint_core_bundle configuration node has the host element to configure the used protocol, hostname and port. Add the configuration matching your infrastructure:

mds_pim_print_core:
    host:
        #hostname: ''
        protocol: 'https'
        port: ''

This configuration leads to download urls like for the error shown above:

https://pimprint-demo.dev/.../PimPrint-DataPrintDemo_blue.indd