Click here to Skip to main content
15,899,679 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
var url = 'D:/Project/Documents/Invoices/invoices/invoice.pdf'; PDFJS.getDocument(url) .then(function(pdf) { 
var elem = document.getElementById('myCanvas');
 $(".document").on('dblclick',function() { 
elem.addEventListener('dblclick', function() { 
}, false); 
var index = $(this).attr("id");
 });
 });



This is the error i'm getting

XMLHttpRequest cannot load file:///D:/Project/Documents/Invoices/invoices/invoice.pdf. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

What I have tried:

I've tried disabling the web security by this command
"chrome.exe --allow-file-access-from-files"
Posted
Comments
F-ES Sitecore 19-Oct-16 9:59am    
getDocument loads the file over http, you can't use it to load files from the local file system (not easily anyway, or on all browsers). If you load the file via a file input then the code can access that file, which is a better solution anyway as how do you know the user has that file in that location on their disk anyway?

https://github.com/mozilla/pdf.js/issues/5057

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900