back

CMD documentation

Once you have signed up and purchased a license, you can download an executable phar file from your project page.

Please make sure your target environment runs at least php7.2 and that the phar extension is installed. The following extensions are required as well:

Using phar as cmd tool

The following example takes the invoice.html, converting it into a pdf and saves it in invoice.pdf.

php typeset.sh.phar render:html invoice.html invoice.pdf

Remote http(s) files

By default, typeset.sh is not allowed to load any resources. This includes images, fonts etc. You need to explicitly grant typeset.sh permission to fetch those resources.
To enable file loading via http(s), use the option --allow-http or -r. This will make it possible for typeset.sh to follow up any http(s) URIs and download it. php typeset.sh.phar render:html -r invoice.html invoice.pdf

Local files

To allow access to local files, you need to whitelist each directory by using the option --allow-local or -l. This will allow typeset.sh to load files within that directory. Use the column : as a path separator if you want to whitelist more than one path.

php typeset.sh.phar render:html -l "/var/www/htdocs:/var/www/public" invoice.html invoice.pdf

You can also use the option --allow-source-dir or -x to allow local access to any file in the same directory as the source file. If no source file is provided (using stdin), then the current working directory is used.

Caching resources

When using remote http(s) resources (e.g. images, fonts, etc.), typeset.sh tries to cache them using the tmp system directory. You can also set your own cache directory using the option --cache-dir or -c. This will prevent typeset.sh from downloading the same resource twice.

php typeset.sh.phar render:html -rx -c /tmp/typeset.sh/ invoice.html invoice.pdf

Still have a question?

Just get in touch with us.

You can also checkout the command line help for quick reference guide as well.

php typeset.sh.phar help