Giter VIP home page Giter VIP logo

draw-image-export2's People

Contributors

alderg avatar davidjgraph avatar m-mohamedin avatar squared9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

draw-image-export2's Issues

Support export to svg

Would be useful support converting a diagram to SVG format.

It is possible to export to a raster (PNG or jpg) or a vector (pdf), but not a vector format that can be natively displayed within a webpage (like a PNG can).

This is possible if the diagram can be exported in svg+xml format.

Should be possible to achieve this in the section of export.js where the PNG/jpg image is extracted (albeit via a screenshot).

The diagram can be exported to svg in draw.io so should be possible to include this logic here, if not possible to retrieve the SVG data as it stands.

npm install fails in node_modules/puppeteer

node 18.2.0
npm 8.12.2
FreeBSD 13.1 amd64

[/tmp]$ git clone https://github.com/jgraph/draw-image-export2.git
…
[/tmp/draw-image-export2]$ cd draw-image-export2
[/tmp/draw-image-export2]$ npm install
npm notice 
npm notice New minor version of npm available! 8.12.2 -> 8.13.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.13.1
npm notice Run npm install -g [email protected] to update!
npm notice 
npm ERR! code 1
npm ERR! path /tmp/draw-image-export2/node_modules/puppeteer
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! /tmp/draw-image-export2/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26
npm ERR!         throw new Error(message);
npm ERR!               ^
npm ERR! 
npm ERR! Error: Unsupported platform: freebsd
npm ERR!     at assert (/tmp/draw-image-export2/node_modules/puppeteer/lib/cjs/puppeteer/common/assert.js:26:15)
npm ERR!     at BrowserFetcher.setPlatform (/tmp/draw-image-export2/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:184:36)
npm ERR!     at new BrowserFetcher (/tmp/draw-image-export2/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserFetcher.js:168:14)
npm ERR!     at PuppeteerNode.createBrowserFetcher (/tmp/draw-image-export2/node_modules/puppeteer/lib/cjs/puppeteer/node/Puppeteer.js:188:16)
npm ERR!     at downloadBrowser (/tmp/draw-image-export2/node_modules/puppeteer/lib/cjs/puppeteer/node/install.js:51:46)
npm ERR!     at download (/tmp/draw-image-export2/node_modules/puppeteer/install.js:86:3)
npm ERR! 
npm ERR! Node.js v18.2.0

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2022-06-27T18_54_59_374Z-debug-0.log

Do you need log-file?

Render background grid

Hi all, is there a way to tell exporter to render the background grid?

I'm trying to automate the diagram generation in project and we must generate with the grid!

This is image exported directly from draw.io:

image

And this is the image exported using this service:

image

Error 500 - testing

Is there a curl command that I can use to test my build? I am getting an error 500 when exporting from a local draw.io build.

I tried this but I got an error:
curl http:///?format=png&bg=ffffff&url=/#Lkarim.xml

But I get a message stating "Bad Request"

Is there a curl command I can use that can pull from a local drawio xml file and output to PDF?

documentation unclear

A collection of questions after reading the README:

The 2018 server-side PNG/PDF export

Does the "2018" part mean it is deprecated?

Updating internal draw.io versions
su chrome

Why do I have to have a user called chrome?

Usage

Well, I thought this is to render drawio files int png/pdf files. It looks like rendering any html into png/pdf, is that correct? If so how do i turn a .drawio into a html?

My use case is the same as this one here: jgraph/drawio-desktop#127 (comment)

On how to use it?

How should this project be used in the VUE project? NPM Start is called after the direct error, how to use the method in detail, does not seem to have a good example

PDF Generation issue

Why sometimes PDF will not generate- 500 internal server error .
Not sure - may be because of file size ??
PDF generation supports - How much file size?

IIS: iisnode encountered an error when processing the request.

iisnode encountered an error when processing the request.

HRESULT: 0x6d
HTTP status: 500
HTTP subStatus: 1013
HTTP reason: Internal Server Error

You are receiving this HTTP 200 response because system.webServer/iisnode/@devErrorsEnabled configuration setting is 'true'.

In addition to the log of stdout and stderr of the node.exe process, consider using debugging and ETW traces to further diagnose the problem.

The last 64k of the output generated by the node.exe process to stderr is shown below:


Application has thrown an uncaught exception and is terminated:
TypeError: handle.setSimultaneousAccepts is not a function
    at target._send (node:internal/child_process:835:16)
    at target.send (node:internal/child_process:752:19)
    at sendHelper (node:internal/cluster/utils:28:15)
    at RoundRobinHandle.handoff (node:internal/cluster/round_robin_handle:131:3)
    at RoundRobinHandle.distribute (node:internal/cluster/round_robin_handle:111:10)
    at handle.onconnection (node:internal/cluster/round_robin_handle:44:54)

ETW trace has this:
<Data>{31AF8149-ECAA-422B-9B42-269624408224}: iisnode was unable to establish named pipe connection to the node.exe process</Data>
Followed these steps to setup IIS, however it is still not working.
image

Any help would be greatly appreciated.

Self-Signed Certificate

Hi all.

Please tell me how puppeteer.js can solve the problem with a self-signed certificate for the address that points to DRAWIO_BASE_URL.

image-export:
        build:
           dockerfile: Dockerfile
           context: ./export        
        expose:
            - "8000"
        networks:
         - drawionet
        restart: always
        environment: 
          - WORKER_POOL_SIZE=1
          - DRAWIO_BASE_URL=https://local.space.d.net

ca-cartificate-update only solves the problem for curl.

warn: Handled exception: net::ERR_CERT_AUTHORITY_INVALID at https://local.space.d.net/export3.html req=ip=::ffff:172.25.0.3 format=pdf w=0 h=0 bg=%23ffffff {"stack":"Error: net::ERR_CERT_AUTHORITY_INVALID at https://local.space.d.net/export3.html\n at navigate (/home/pptruser/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Frame.js:171:27)\n at process.processTicksAndRejections (node:internal/process/task_queues:95:5)\n at async Deferred.race (/home/pptruser/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/util/Deferred.js:36:20)\n at async CdpFrame.goto (/home/pptruser/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/cdp/Frame.js:137:25)\n at async CdpPage.goto (/home/pptruser/draw-image-export2/node_modules/puppeteer-core/lib/cjs/puppeteer/api/Page.js:590:20)\n at async renderPage (/home/pptruser/draw-image-export2/export.js:569:8)\n at async handleRequest (/home/pptruser/draw-image-export2/export.js:711:20)"}

I found a solution by putting the '--ignore-certificate-errors' flag in puppeteer.launch, but I'm not completely satisfied with it

browser = await puppeteer.launch({
	headless: 'new',
	args: ['--disable-gpu', '--no-sandbox', '--disable-setuid-sandbox', '--disable-dev-shm-usage', '--ignore-certificate-errors']
});

Unable to export a specified page when a preceeding page contains brackets in its name

This diagram diagram has 3 pages:

  1. "First page"
  2. "Second page (of 2)"
  3. "Page-3"

Note, the file has been renamed from Sample file.xml to Sample file.txt to support GitHub attachment.

It is possible to export "First page" by specifying the pageId=0 parameter in an export request.

It is not possible export "Second page (of 2)" with the pageId=1 parameter in an export request, this is always interpreted as the last page. In short, "Page-3" gets rendered in every case, except where pageId=0.

This has been tested where the page names do not contain brackets and it behaves as expected.

The export url being used is: https://exp.draw.io/ImageExport4/export

With a payload equivalent to:

filename=preview&format=png&xml=

<file content>&base64=O&bg=#ffffff&w=500&h=500&border=1&pageId=1

Can you confirm if this is an issue or whether the export route requires different parameters?

CPU count detection works wrong

Latest commit introduced pool of workers, based on os.cpus().length.
This features works wrong in Linux containers, where it may see all the physical cores (e.g. 32), but the container is limited to a lesser value (e.g. 1), and thus it creates unreasonably large pool.

More reliable detection for containers would be to attempt to read something like /sys/fs/cgroup/cpu/cpu.cfs_quota_us and /sys/fs/cgroup/cpu/cpu.cfs_period_us, but the more simple and straightforward way would be to just support passing pool size via some environment variable, something like process.env.WORKER_POOL_SIZE.

Could you support it please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.