Comments (4)
In addition to making your workspace accessible without authentication (/share
in the URL suggests that you've made the workspace public, which may be okay for your use case, but I'd generally advise caution doing this), you may find the image URL doesn't work as expected. The images behind those static URLs are not regenerated immediately when a workspace has been modified, so you will very likely see an older version at times. We've added the PNG export button to the embedded iframe.
That said, to answer the question of the issue title, "Is it possible to download a diagram as an svg/png through the web api?":
- No. The JSON based web API, and by extension the .NET client library, does not have the ability to download PNG versions of the diagrams.
- If you want to download the current diagram(s) as PNG files, via the command line, you'll need to use Puppeteer to start up a web browser in headless mode.
from dotnet.
Unfortunately not, because the diagrams are rendered client-side. You could potentially use the Scripting API via Puppeteer though.
from dotnet.
I made it work, by using a hyperlink with the download property.
<a url="https://structurizr.com/share/{workspaceId}/{diagramId}/images/{imageName}.png" download/>
This does not prompt for a download, as that is not supported by browsers (see this), but it does open the image in a new tab, so the rest is just to right click and save as image.
Thanks for sharing Puppeteer, I'll try to fiddle some with it to see if that makes for a better solution :-)
from dotnet.
Thanks, I did notice the images were not available at all times, and came to the same conclusion with regard to security issues.
Nice to hear you've added an export button. That solves my use case even better 👍
from dotnet.
Related Issues (20)
- problem HOT 1
- Default RankDirection not being serialized HOT 7
- EnableAutomaticLayout not working HOT 2
- dsl to C# serializer HOT 1
- EnableAutomaticLayout per default
- DefaultLayoutMergeStrategy breaks in certain scenarios HOT 4
- How can I model linked workspaces via CLI? HOT 2
- Exporting/embedding private workspace diagrams HOT 3
- Terraform support HOT 3
- Can't remove elements from model HOT 3
- Provide working example of loading layout information from an existing workspace.json HOT 1
- hi HOT 2
- Any chance for a dsl parser in c#? HOT 1
- Please make the archive-file optional HOT 3
- QUESTION: Will DSL be supported, will PutWorkspace keep working when workspace is deprecated? HOT 3
- the uploaded workspace of 0.54MB exceeds the size limit of 0.50MB HOT 3
- .net client won't preserve view custom size HOT 1
- Relationship between Person and Container not showing HOT 4
- Control RelationshipStyle on Dynamic View HOT 1
- Include mode on Filtered Views not working HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet.