The Datawrapper Developer Hub

Welcome to the Datawrapper developer hub. You'll find comprehensive guides and documentation to help you start working with the Datawrapper API as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Exporting as PNG, PDF & SVG

Chart export options

Once you're happy with the design of your visualization, you can publish it and/or export it as a PNG (free) or PDF/SVG (starting at the Custom plan), e.g. to embed it in presentations. In this tutorial, you'll learn how to do so with the API.

Request the export

The actual request is fairly simple. Make sure to replace <ID> and <YOUR_TOKEN_HERE> with your chart ID and your API Access Token:

curl --request GET \
     --url 'https://api.datawrapper.de/v3/charts/<ID>/export/png?unit=px&mode=rgb&plain=false&zoom=2&borderWidth=20' \
     --header "Authorization: Bearer <YOUR_TOKEN_HERE>" \
     --header 'accept: */*' \
     --output 'final.png'

The output gets saved in the folder where you run the command. Let's look at the request in detail, especially the url part.

Export parameters

As you can see, the URL includes all parameters with which we define the output. It looks complicated, but almost nothing is mandatory.

📘

To save time, simply go to the API reference developer.datawrapper.de/v3.0/reference#getchartsidexportformat and you'll find an interface in which you can just input the desired parameters.

Let's break the URL down anyway. The parameters can be different depending on if you want to download a PNG, PDF or SVG. If unsure, visit the export interface of the visualization in the Datawrapper app (step 4: Publish) and see which features are available there. Scroll down to see the interfaces.

Parameter

Description

PNG

PDF

SVG

.../export/pdf

Here you define the output format.

png

pdf

svg

unit

Defines the unit in which the borderWidth, height and width will be measured in.

px

px inch mm

--

mode

Which color mode the output should be in. Default is rgb.

--

rgb cmyk

--

width

Width of the visualization. If not specified, it takes the chart width.

Number

Number

Number

height

Height of the visualization. If not specified, it takes the chart height.

Number

Number

Number

plain

Defines if only the visualization should be exported (true), or if it should include header and footer as well (false).

true false

true false

--

zoom

Defines the chart scale. E.g, a zoom of 3 makes the chart 3 times wider and taller in px size resulting in a higher resolution chart. Default is 2.

Number

--

--

scale

Defines the chart scale for PDF exports, similar to the zoom parameter for PNGs.

--

Number

--

borderWidth

Margin around the visualization. E.g., a borderWidth of 20px gives the visualization a 20px margin. Default is 0.

Number

Number

--

borderColor

Color of the border. Default is the same color as the visualization background (most often, that's white).

Color

Color

--

transparent

Set to true to export your visualization with a transparent background. Will override borderColor.

true false

--

--

Updated 4 months ago

Exporting as PNG, PDF & SVG


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.