Which product are you using?
PDF.js Express Viewer
PDF.js Express Version
8.3
Detailed description of issue
The latest Mac OS Monterey 12.5.1 can not work with “printInBackground”.
The function won’t work after upgrading 12.5.1.
Even I am using latest version of Chrome. It is still.
Expected behaviour
It should prompt printer dialog.
Does your issue happen with every document, or just one?
every document.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
Does the issue only happen for MacOS Monterey on Chrome?
Is it reproducible on MacOS different browsers?
Is it reproducible on different OS on Chrome?
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
I think browserStack can not specify the mac os version.
Because we didn’t open the print feature for other browsers.
Currently, this only happened on 12.5.1 Intel chip mac with the latest Chrome.
Does your dev environment use 12.5.1 as well?
Do you know what else situation can cause the issue?
Should I let merchants test it on different browsers?
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
I am unable to reproduce the issue on Chrome with Intel Chip on the same MacOS version.
Can you send me a video or access to the environment to reproduce the issue?
Thank you in advance.
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
Another problem could be related to the older PDFjs version. If possible can you upgrade and see if it is reproducible?
Thank you in advance.
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
This post seems to talk about the issues of accessing the iframe through cross-origin:
It looks like window.postMessage can help with this problem.
Here is a similar forum post regarding the issue:
which leads to using this guide to setup config file for cross-origin:
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
Hi there, thanks for the quick reply.
It is a bit different. Because the issue only happened when the print button was clicked.
In other words, the viewer showed up and worked well without prompting any CORS error except for when print button clicked. The CORS error is triggered only when we click the print button.
We load documents in blob URL format, not web URLs. Is it a case that could lead to the issue?
I attached the network image for a better understanding. This request occurs when clicking the print button.
The file is at the exact same origin. The image below is my environment.
Do blob:https://google.com and https://google.com are the same origin?
If they are of the same origin, why does the error only happens when printing?
We can implement post messages, but we want to clarify the root cause first.
Do you think that we add “blob:hostname” to the white list of pdfjs.express.
Would that be helpful?
When the print modal shows up, do you have the same url request to the blob? Does the image preview properly show up?
From the screenshot the 200 response status should mean that you would be able to retrieve the blob when clicking the print button.
As for the blob URL vs web URL, I believe they are not in the same context hence adding the blob URL to the whitelist won’t make a difference here.
What is considered same origin or not:
Where as blob URL is created from URL.createObjectURL():
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
Hi kkim, thanks for getting me back.
the image preview is okay and show up properly, the issue only happen when he click print button.
The image below comes from the client, and you can see that although the response status is 200 but it still shows an error here.
Is there any way that we can do more tests on his environment to see if there is any issue happening on his Chrome 104 latest browser?
Is that the expected network behaviour for your other users that are not experiencing this issue?
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here
Hi,
No, all the other users won’t encounter load base64 URL behavior.
We are using blob URL to load and embedded print, so it will only show blob:HTTP://HOST on the network request.
Base64 will change print orientation by default, so we prefer to use embedded print to keep it the same.
Although he can open your demo site and print it out without any issue.
But I think the main difference is we are using blob URL to load documents.
However, the demo site uses using PDF URL to load documents, not blob URL.
If you are using blob URL to load, I think it won’t show the base64 request here.
This is the extra error message.
Do you want to try on our testing environment? I can prepare an account for you.
I will let the client try base64 print as well ( without embedded print ).
I managed to find another ticket similar to this issue where a problem was solved with disabling all extensions and trying incognito/private mode. Can you see if that resolves the issue?
Best Regards,
Kevin Kim
Web Development Support Engineer
PDFTron Systems, Inc.
Share how you are using PDF.js Express in your organization you could win a $500 Amazon gift card. All participants will receive 6 months of PDF.js Express+ for free. Learn more here