I can successfully export to the local but there is no style in the PDF. How should I configure it
pdfExport : {
exportServer : 'https://dev.bryntum.com:8082',
// Development config
translateURLsToAbsolute: true,
// For production replace with this one. See README.md for explanation
// translateURLsToAbsolute : 'https://localhost:8080/resources/', // Trailing slash is important
keepPathName : false
},
Attachments
屏幕截图 2022-05-11 193055.png (127.82 KiB) Viewed 1184 times
You should not configure the pdf feature to point to our server, you should follow the instructions in that demo and setup a server in your own network.
# Export demo
This demo shows how to use export to PDF/PNG feature with Gantt.
It includes server which gets HTML from browser and makes PDF/PNG.
Setup
Setup the server
Server is located in examples/_shared/server
Navigate to examples/_shared/server/README.md for instructions.
Usually it should be enough to run:
cd examples/_shared/server/ && npm i && node ./src/server.js -h 8080 -r /path/to/resources
where /path/to/resources is the physical path to the root folder which contains styles.
The path can be either absolute (/path/to/resources) or relative (path/to/resources),
for example when you start the export server with the export demo locally.
It is required to correctly load FontAwesome which is used to show icons.
For example
const gantt = new Gantt({
features : {
pdfExport : {
exportServer : 'https://export-host:8080',
translateURLsToAbsolute : 'https://export-host:8080/resources'
}
}
})
where /resources is a virtual path hardcoded in server/WebServer.js implementation.
Running the server with -r maps the virtual path to the real style's location.
Just need to copy all the styles and fonts from the https://application-host/ keeping the folder hierarchy.
By default, the example is configured to use localhost:8080 as export host.
Open this example in the browser, press Export and check various export options
Alternate setup (Docker)
You can use our Docker image to run the export server. To start the container run:
examples/_shared/server$ docker-compose up -d --build
Feature config should be changed too:
new Gantt({
features : {
pdfExport : {
// Assuming Docker is running locally
exportServer : 'https://localhost:8080/',
// Docker runs in own subnet, it should be able to access global address of the exported page
translateURLsToAbsolute : 'https://external-address:80/',
// This is required only if you do not choose to enable CORS on web server.
// In case your web server provides `Access-Control-Allow-Origin: *` header, this can be omitted.
clientURL : 'https://external-address:80/'
}
}
})
See corresponding section in examples/_shared/server/README.md for more details.
In your console log I see "permission denied" error. Try to set up your environment to allow using port 8080, or check if something already uses that port, or try to change port to another one.
In _shared/server/README.md You will find detailed instructions about server setup.
Try to google error message you see in console, it's common problem not related to Bryntum that has a lot of solutions on StackOverflow.
This happens because you use https protocol. I am not sure about your local server setup. You could try to search how to fix "net::ERR_SSL_PROTOCOL_ERROR" error for your environment
or just don't use 'https'.
Here is a good guide about that error: https://aboutssl.org/fix-google-chrome-error-err_ssl_protocol_error/
Thank you I can successfully export now, but I have a question, I started the Node service locally, what if the project is published to the server then