The svg-to-pdf call converts a SVG file to PDF using Inkscape.
A simple request has the following structure:
The token refers to a previously uploaded SVG blob. The file is passed to inkscape, and the resulting PDF file is again stored as a blob.
If the source file refers to external resources, these resources must be uploaded as blobs as well, and specified in the request:
All resources are staged in a folder alongside the SVG file before calling inkscape.
To use the PDF call, the account must have the svg-to-pdf
flag set to true
:
Converts a SVG blobs to PDF.
Using Backend.js, a SVG file can be converted to PDF as follows:
const backend = new Backend('https://viereck.ch/backend'); const account = backend.account('your-account-id', '44705748... your-account-key'); const svgToken = 'd94d3886...'; const resources = [ {name: 'logo.png', '#b': '7b8cf18d...'}, ... ]; account.svgToPdf(svgToken, resources, onDone, onError); function onDone(token, request) { ... } function onError(errorCode, request) { ... }
All SVG files and resources must be uploaded beforehand, if necessary.