Skip to content

Commit

Permalink
Provide placeholder for pdf creation
Browse files Browse the repository at this point in the history
Should be implemented later with jsPDF
  • Loading branch information
linev committed Apr 26, 2018
1 parent 613b51f commit b777d5e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions openui5/controller/Canvas.controller.js
Expand Up @@ -140,6 +140,7 @@ sap.ui.define([
case "Canvas.png":
case "Canvas.jpeg":
case "Canvas.svg":
case "Canvas.pdf":
p.SaveCanvasAsFile(name);
break;
}
Expand Down
4 changes: 2 additions & 2 deletions openui5/view/Canvas.view.xml
Expand Up @@ -16,12 +16,12 @@
<items>
<MenuItem text="Open" icon="sap-icon://open-folder" />
<MenuItem text="Close canvas" icon="sap-icon://decline" />
<MenuItem text="Save" startsSection="true"
icon="sap-icon://save">
<MenuItem text="Save" startsSection="true" icon="sap-icon://save">
<items>
<MenuItem text="Canvas.png" />
<MenuItem text="Canvas.svg" />
<MenuItem text="Canvas.jpeg" />
<MenuItem text="Canvas.pdf" />
</items>
</MenuItem>
<MenuItem text="Save as ..." icon="sap-icon://save" />
Expand Down
3 changes: 3 additions & 0 deletions scripts/JSRootPainter.v6.js
Expand Up @@ -3624,6 +3624,9 @@
TPadPainter.prototype.CreateImage = function(format, call_back) {
if (format=="svg") {
JSROOT.CallBack(call_back, btoa(this.CreateSvg()));
} else if (format=="pdf") {
// use https://github.com/MrRio/jsPDF in the future here
JSROOT.CallBack(call_back, btoa("dummy PDF file"));
} else if ((format=="png") || (format=="jpeg")) {
this.ProduceImage(true, 'any.' + format, function(can) {
var res = can.toDataURL('image/' + format),
Expand Down
6 changes: 4 additions & 2 deletions scripts/JSRootPainter.v7.js
Expand Up @@ -3324,6 +3324,9 @@
TPadPainter.prototype.CreateImage = function(format, call_back) {
if (format=="svg") {
JSROOT.CallBack(call_back, btoa(this.CreateSvg()));
} else if (format=="pdf") {
// use https://github.com/MrRio/jsPDF in the future here
JSROOT.CallBack(call_back, btoa("dummy PDF file"));
} else if ((format=="png") || (format=="jpeg")) {
this.ProduceImage(true, 'any.' + format, function(can) {
var res = can.toDataURL('image/' + format),
Expand Down Expand Up @@ -3422,8 +3425,7 @@
//rrr.setSize(sz.width, sz.height);
//rrr.render(main.scene, main.camera);

main
.insert("g",".primitives_layer") // create special group
main.insert("g",".primitives_layer") // create special group
.attr("class","temp_saveaspng")
.attr("transform", "translate(" + sz.x + "," + sz.y + ")")
.node().appendChild(svg3d); // add code
Expand Down

0 comments on commit b777d5e

Please sign in to comment.