Hi, I'm trying to do a gantt export, I put in the config sendAsBinary to true, but when I do the export I can't find the binary in the response. How can I get my binary in the response?
Support Forum
Hi idirlb,
We have Export WebServer example in our demos. To get it you need to download sources and check examples/_shared/server
I am not sure I got you right, on case not, please provide more context about the problem you experienced. To get fastest support, please attach a runnable test case that we could debug.
All the best,
Alex
I have this config :
const gantData = {
columns: [
{ type: "name", field: "title", text: "Tâches" },
{ type: "name", field: "qua", text: "QUA." },
{ type: "name", field: "uni", text: "UNI." },
{ type: "name", field: "cad", text: "CAD." },
{
field: "time",
icon: "pro-fonts icon-time",
text: "",
},
],
tasks: [],
features: {
pdfExport: {
exportServer: getEnv("VUE_APP_BRYNTUM_URL"),
paperFormat: "A3",
orientation: "landscape",
fileFormat: "png",
openAfterExport: false,
sendAsBinary: true,
},
},
viewPreset: "dayAndWeek",
};
and when I want to export I do this :
await this.$refs.ganttDataRef.instance.value.features.pdfExport
.export({
columns: this.ganttDataRef.instance.value.columns.map(
(c) => c.id
),
})
.then((res) => {
console.log(res)
})
.catch(console.error);
In the variable res I can't find the binary
I tried here https://bryntum.com/examples/gantt/export/ to apply your config to pdfExport
feature, and change onClick
handler for exportButton
to
onClick() {
gantt.features.pdfExport.export({columns:gantt.columns.map((c)=>c.id)}).then(({ response })=>{
console.log(response.headers.get('Content-Type'));
console.log(response.body);
});
}
and all looks good to me. Does it work for you?
All the best,
Alex
Please read these articles
https://isotropic.co/what-is-octet-stream/
https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data
All the best,
Alex
Get the most out of your IT projects. Learn about the different types of IT project outsourcing, the features to consider, and a simple guide to get started (https://light-it.net/blog/it-project-outsourcing/). Also, learn how outsourcing can help with application development and more.