Hello,
After a pdf has been loaded into the pdfviewer, is it possible to clear the viewer?
I’ve tried $$(‘viewer’).load(’’); with no luck.
Best Regards,
jharris
Hello,
After a pdf has been loaded into the pdfviewer, is it possible to clear the viewer?
I’ve tried $$(‘viewer’).load(’’); with no luck.
Best Regards,
jharris
Hello,
The current Webix version does not provide a simple way to clear the PDF Viewer, but we are planning to add such functionality with the nearest update (already in the dev build).
For now you can use the following code to clear the document and reset the related toolbar, if any: http://webix.com/snippet/bee21898
Just what I needed.
Thank you for the help Helga.
Snippet is empty , http://webix.com/snippet/bee21898, can you provide the source ?
I’m using Webix in a Android WebView a having memory problems after showing about 15 Pdf’s …Memory isn’t clear somewhere in the PDFviewer
Hello,
The snippet is displayed normally for me, but here’s another link to the same sample:
http://webix.com/snippet/fd8389f0
And the code itself:
webix.ui({
type:"space",
rows:[
{view:"button", inputWidth:150, value:"Clear doc", click:function(){
var canvas = $$("pdf").$view.getElementsByTagName("CANVAS")[0];
var container = canvas.parentNode;
var context = canvas.getContext('2d');
context.clearRect(0, 0, canvas.width, canvas.height);
container.style.height = container.style.width =
canvas.width = canvas.height = 0;
this.config.scale = "auto";
this.$pageNum = this.$numPages = 0;
this.$pdfDoc = null;
$$("toolbar").setValues("0", "auto");
$$("toolbar").setPage(0);
}},
{ view:"pdfbar", id:"toolbar" },
{
view:"pdfviewer", id:"pdf", toolbar:"toolbar",
url:"binary->http://docs.webix.com/samples/60_pro/10_viewers/files/WebixDocs.pdf"
}]
});
Starting from 4.1 it’s possible to clear the PDF viewer with the help of the related .clear()
method: http://webix.com/snippet/f8e6e80a
Basically, it does the above mentioned logic, but offers it out of the box )