Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

localstorage #55

Open
jesesqui opened this issue Mar 1, 2022 · 0 comments
Open

localstorage #55

jesesqui opened this issue Mar 1, 2022 · 0 comments

Comments

@jesesqui
Copy link

jesesqui commented Mar 1, 2022

I'm trying to do an autosave with localstorage and it works assigning the key and the value like this:
var pdf = new PDFAnnotate("pdf-container", "my_document.pdf", {
onPageUpdated(page, oldData, newData) {
localStorage.setItem(page, JSON.stringify(newData));
console.log("page "+ page, oldData, newData);
},
and then with a button to load the localstoage but this last one without success, could you guide me on how to achieve this

var canvas = document.getElementById('pdf-container'),
document.getElementById("btnLoad").onclick = function () {
var idt = localStorage.getItem(1) || null;
if (idt !== null) {
var data = JSON.parse(idt);
canvas.putImageData(idt, 0, 0);
}
localstorage

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant