-
Notifications
You must be signed in to change notification settings - Fork 273
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
Error: Cannot parse (FILE) as an image #164
Comments
I have the same problem, and a problem as a result of this one too. Research told me that the given file url must be accessible by the java applet, eg. without authentication. (Check! but it stil couldn't "parse" it) Then I tried to turn it into base64 data; which comes in via an ajax-request. Something's up with QZ2+ and 1.9 is deprecated by now. This should be solved asap. |
Hey Xewl, good to know im not the only one facing this issue. I also crossed out the authentication part since im able to access the files with no issue through a different browser, port or server. May i know if your files are saved in any framework? Currently developing this on laravel. |
var printData = [
{type: 'image', data: '/load/ReceiptLogo.png'},
'\nPrinted using qz-tray plugin.\n\n\n\n\n\n'
]; @shaneguna can you please clarify something? What I'm reading is that you are appending an image along with raw text, however I do not see a raw image format specified. Here is an example from our wiki which has the image format specified. var printData = [
{ type: 'raw', format: 'image', data: '/load/ReceiptLogo.png', options: { language: "escp", dotDensity: 'double' } },
'\nPrinted using qz-tray plugin.\n\n\n\n\n\n'
]; If that does not work, I would suggest double-checking your image URL and security access, such as opening a new private browsing session (CTRL + SHIFT + N) to
Base64 Images aren't currently compatible with raw. You're right, this is a regression from 1.x versions. We've fixed it for 2.1 but it required an API change, so we decided not to backport it to 2.0 See #70. |
Hi @tresf, Thank you for responding. The issue seems to be with the served port not being accessible by the java applet. I added my application through the vhosts list of the server and it worked. So, the suggestion with regard to the URL access is the reason why the files are not being parsed. Right now, i'm still facing issues with printing image format as raw type. Its returning same error that its not able to parse, this is not happening for image type. I thought of a workaround to chain the printing by calling another function that will print raw texts unfortunately after calling the function that prints Thanks PS. As for future reference of other laravel dev's, i havent tested if this is the same case in Ubuntu. |
Hi @tresf, Sorry, found a possible solution in the docs. Let me try this out first. https://qz.io/wiki/2.0-Raw-Printing#chaining-requests Regards. |
Hi @tresf, To update, chaining requests work but the problem is i'm not able to follow my format. Is there a way to override cutting of paper after printing for image types or, if you could aid me with the error faced when printing image as raw this would be better as i will be able to print everything in raw. { type: 'raw', format: 'image', data: '/load/ReceiptLogo.png', options: { language: "escp", dotDensity: 'double' } }
Best Regards. |
Hi @tresf, The last mentioned issue seems to be compatibility of the printer to recognize esc/p commands. Thank you very much for your time. |
{
type:'raw',
format:'image',
data:'/load/ReceiptLogo.png',
options: {
language:"escp",
dotDensity:'double'
}
} That looks fine. I assume you have it wrapped into an array?
It shouldn't be cutting automatically, you should be sending a cut command, which a lot of our clients do. (e.g. https://qz.io/wiki/2.0-Raw-Printing#escp
If that is the case, you can try QPCPrint on Windows 7 to see if you can get some valid ESC/P output. |
Hi , how u make to enable the application throught vhosts ? My server its a RHRL 7. Thanks . |
Got same error with @shaneguna .
in qztray 2.0.5, 2.0.7 This's my setting
Don't know how to fix this. |
That's just a generic error that's thrown if the |
@shaneguna @tresf facing same error:
Have you guys resolved this issue? |
@shaneguna as @tresf mentioned before, this is a generic error. Can you please launch the software from console and share the full stack trace with us? A code snippet would also assist us. This could be as simple as an incorrect url for |
@klabarge Below is the code snippet that i am using for image printing: Error stack trace: Note: Image printing is working fine while using sample.html (From QZ demo) and clicking on Print ESC/POS |
{ type: 'raw', format: 'image', data: 'image_sample_bw.png', options: { language: 'ESCPOS', dotDensity: 'double' } } You're probably running authentication on port |
@tresf Thanks for your kind response. I have used your suggestion and now it's working for me. Imported image like this: And I used in this way: |
@shehzadosama wow, I was unaware JS could automagically import a base64 image. Are you using Angular? This is a slick technique, I wish the browser had such a function. :) |
@tresf I am using ReactJS. |
Hi guys, i'm experiencing an issue while printing images or pdf.
Im currently using qztray to print a receipt after placing an order. Im running on a windows machine.
Pretty much stuck right here, when running the demo/sample page im able to print images with no issues.
This is my js code.
`
function print(printOrderDetails) {
}`
Im getting this error once this function is called.
Error: Cannot parse (FILE)http://localhost:1234/load/ReceiptLogo.png as an image at WebSocket._qz.websocket.connection.onmessage (qz-tray.js:271)
To add, i get these logs from qz tray.
Hoping for your assistance. Thank you.
The text was updated successfully, but these errors were encountered: