PDF Export Demo
This demo shows how to export the whole diagram or a part of it to a PDF.
Things to Try
-
Press
Export
and export the graph as PDF image.
-
Enable
Export Rectangle Contents
to export only the rectangle's region instead of whole graph. Resize and move rectangle
to control the region which will be exported.
-
Explore the settings for page size, scale, and margin. Note that the scale option only
has an effect if page size is set to
Automatic
.
-
The client-side PDF export also supports custom fonts which is illustrated by the node
labels with custom fonts. To make use of custom fonts, they need to be preprocessed and
registered at the
jsPDF
instance. Please see the
readme
for more details.
- Try to export the image using a Node.js server.
Details
The demo shows an approach that completely runs in the client's browser, as well as an
approach for a server-side export. The client-side export uses
svg2pdf
and
jsPDF
where we contributed major changes and extensions. Please see its readme on
github.com
. Although our fork of
jsPDF
adds many features like gradients and line style support, the actual export result may
differ from the graph in the graph component.
Server-side export
The server-side export is a minimal example of how to export the graph using an external
service hosted on a server. It shows the export via a Node.js express server using
headless Chrome/Puppeteer
.
The server-side export button will be enabled, when the Node.js is alive on loading time
of the demo. To run the server, see the respective readme in
./node-server/
.