I am trying to print the document from my local folder by using google cloud print, but it reports the error Could not fetch the URL. this folder is on my htdocs folder & document file & code file is on the same folder. But am unable to find whats wrong.
here is my print dialog js code :
<script src="https://www.google.com/cloudprint/client/cpgadget.js">
</script>
<script>
window.onload = function() {
var gadget = new cloudprint.Gadget();
gadget.setPrintButton(cloudprint.Gadget.createDefaultPrintButton("print_button_container")); // div id to contain the button
gadget.setPrintDocument("url", "Test Page", "");
gadget.setPrintDocument("application/pdf", "PDF Doc" );
gadget.setPrintDocument("url", "Test Page", "http://localhost/pos/test.pdf");
var btn = document.getElementById("custom_print_button");
gadget.setPrintButton(btn);
gadget.openPrintDialog();
}
</script>
I have tried both the form of url i.e http://localhost/pos/test.pdf or test.pdf but unable to fetch the doc. please any one have idea how to pass the doc url to be print.