You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation export feature will create a single HTML page that includes all documentation currently being displayed. Please note that diagrams with a perspective enabled with not be interactive (you'll be missing the tooltips), and the graph visualisation will be excluded entirely from the export.
13
13
14
-
## Manual export
15
-
16
14
When viewing documentation, click the  link. This feature may not work if popups are blocked, so please ensure that popups are allowed in your web browser.
17
-
18
-
## Automated export
19
-
20
-
Documentation is rendered client-side (i.e. in your web browser), so an automated export is only possible using a web browser
21
-
in conjunction with an automation framework such as headless Chrome and Puppeteer.
22
-
See the [structurizr-puppeteer repo on GitHub](https://github.com/structurizr/puppeteer) for an example script.
The Structurizr UI provides a small JavaScript API that can be used to script and automate certain tasks. This is available under a JavaScript variable called `structurizr.scripting` when viewing the documentation pages. The following functions are provided:
13
13
14
-
-`exportDocumentationToOfflineHTMLPage(callback)`: Exports the currently loaded documentation to a single HTML page for offline use. The callback function is called when generation of the HTML page has been finished, and the first function argument is the resulting HTML markup.
15
-
16
-
## Puppeteer
17
-
18
-
The diagram scripting API can be used in conjunction with tools such as Puppeteer (headless Chrome/Chromium),
19
-
to automate the export of documentation from the command line, perhaps as a part of a build process.
20
-
The [structurizr-puppeteer repo on GitHub](https://github.com/structurizr/puppeteer) has some code samples of how to do this.
14
+
-`exportDocumentationToOfflineHTMLPage(callback)`: Exports the currently loaded documentation to a single HTML page for offline use. The callback function is called when generation of the HTML page has been finished, and the first function argument is the resulting HTML markup.
Please note that diagrams are rendered client-side (i.e. in your web browser), so this API __does not__ provide access to diagrams. An automated export is only possible using a web browser in conjunction with an automation framework such as headless Chrome and Puppeteer. See the [structurizr-puppeteer repo on GitHub](https://github.com/structurizr/puppeteer) for an example script.
62
+
Please note that diagrams are rendered client-side (i.e. in your web browser), so this API __does not__ provide access to diagrams. An automated export is available via the [export PNG/SVG command](/export/png-and-svg).
Copy file name to clipboardExpand all lines: commands/03-server/71-scripting.md
+1-7Lines changed: 1 addition & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,4 @@ The following functions are provided for diagrams:
27
27
28
28
And the following functions are provided for documentation:
29
29
30
-
-`exportDocumentationToOfflineHTMLPage(callback)`: Exports the currently loaded documentation to a single HTML page for offline use. The callback function is called when generation of the HTML page has been finished, and the first function argument is the resulting HTML markup.
31
-
32
-
## Puppeteer
33
-
34
-
The diagram scripting API can be used in conjunction with tools such as Puppeteer (headless Chrome/Chromium),
35
-
to automate the export of diagrams from the command line, perhaps as a part of a build process.
36
-
The [structurizr-puppeteer repo on GitHub](https://github.com/structurizr/puppeteer) has some code samples of how to do this.
30
+
-`exportDocumentationToOfflineHTMLPage(callback)`: Exports the currently loaded documentation to a single HTML page for offline use. The callback function is called when generation of the HTML page has been finished, and the first function argument is the resulting HTML markup.
Copy file name to clipboardExpand all lines: commands/04-export/06-png-and-svg.md
+56-5Lines changed: 56 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,62 @@ has_children: false
8
8
has_toc: false
9
9
---
10
10
11
+
> This feature is currently only available by building from source or using [the preview version of the Java .war file](/binaries#java-war-file).
12
+
11
13
# PNG and SVG
12
14
13
-
Structurizr `local` and `server` render PNG/SVG diagrams in your web browser, and therefore exporting these diagrams is not supported from the `export` command.
14
-
PNG/SVG diagram exports can instead be automated using headless Chrome and Puppeteer:
15
+
Exports PNG or SVG images using the Structurizr browser-based renderer from:
16
+
17
+
-[A running local instance](#local)
18
+
-[A running server instance](#server)
19
+
-[A DSL or JSON file](#dsl-or-json-file)
20
+
21
+
## local
22
+
23
+
Export PNG/SVG images from a running [local](/local) instance:
24
+
25
+
```
26
+
export -format png|svg -url <url> ...
27
+
```
28
+
29
+
-`url`: The URL must be the _diagrams page_ for the workspace you would like to export (required); for example:
30
+
-`http://localhost:8080/workspace/1/diagrams`
31
+
-`-output`: The output directory (optional; default=current working directory)
32
+
-`-mode`: `light` or `dark` colour scheme (optional; default=`light`)
33
+
-`-animation`: `true` to export animation steps, `false` otherwise (optional; default=`false`)
34
+
35
+
## server
36
+
37
+
Export PNG/SVG images from a running [server](/server) instance:
38
+
39
+
```
40
+
export -format png|svg -url <url> ...
41
+
```
42
+
43
+
-`url`: The URL must be the _unauthenticated diagrams page_ for the workspace you would like to export (required); for example:
44
+
-`http://structurizr.example.com/workspace/1/diagrams` (server with authentication disabled)
45
+
-`http://structurizr.example.com/share/1/diagrams` (server with authentication enabled + workspace with public link enabled)
46
+
-`http://structurizr.example.com/share/1/c2586b8c-91e5-4d62-b490-186112c51565/diagrams` (server with authentication enabled + workspace with sharing link enabled)
47
+
-`-output`: The output directory (optional; default=`.`)
48
+
-`-mode`: `light` or `dark` colour scheme (optional; default=`light`)
49
+
-`-animation`: `true` to export animation steps, `false` otherwise (optional; default=`false`)
50
+
51
+
## DSL or JSON file
52
+
53
+
Export PNG/SVG images from a DSL or JSON file:
54
+
55
+
```
56
+
export -format png|svg -workspace <path> ...
57
+
```
58
+
59
+
-`workspace`: The path or URL to the workspace DSL/JSON file (required)
60
+
-`-output`: The output directory (optional; default=workspace directory)
61
+
-`-mode`: `light` or `dark` colour scheme (optional; default=`light`)
62
+
-`-animation`: `true` to export animation steps, `false` otherwise (optional; default=`false`)
63
+
64
+
This will export the specified workspace to a [static site](/export/static-site) and export images from that static site. The same [workspace processing](/export/static-site#workspace-processing) applies as when exporting a static site, so you will need to use a JSON file if you have manual layout.
-[github.com/structurizr/puppeteer](https://github.com/structurizr/puppeteer) for some example scripts
68
+
- This feature uses the Microsoft Playwright framework to drive a headless version of the Chromium browser, and a version of Chromium will be automatically downloaded the first time. This may take some time.
69
+
- Playwright requires some additional local dependencies to be available, so this feature isn't currently available via the prebuilt `structurizr/structurizr` Docker image.
0 commit comments