Disabled Printing but CTRL + P still prints

New Here ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Hello -

So I've disabled printing and downloading in the embed API per the documentation (showPrintPDF and showDownloadPDF are set to false). I've also set a css attribute to @media print { display: none} for the container div. Both of these methods work and cover the file -> print (PDF does not display in file -> print which is good). However, when a user mouses over the document and hit CTRL (CMD) + P, they are still able to print. How can this be disabled? I've tried the @media print route with no luck. 

Screenshot attached of the print dialog that comes up with CTRL + P.Screen Shot 2021-05-06 at 11.22.50 AM.jpeg

Views

200

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

When showPrintPDF is false, Embed API will not print the PDF file through its own print code, however, the browser will still print the contents of the body tag. With the embed mode set to "IN_LINE", it will appear that the PDF is printing when in fact it isn't. To prevent the printing of the contents of the element that Embed API draws into, add a CSS statement to hide the element that you are using for the divId. Be sure to add !important because... well... it's important.

 

Note: I've only tested this in Chrome. Let me know if you are seeing other behavior in other browsers and please be specific as to version numbers.

 

 

<!doctype html>
<html>
<head>
	<meta charset="UTF-8">
	<title>Shouldn't Print</title>
	<style>
		body {
			padding: 0;
			margin: 0;
		}

		@media print {
			.noprint {
				display: none !important;
			}
		}
	</style>
	</style>
</head>
<body>
	<div id="adobe-dc-view" class="noprint"></div>
	<script src="https://documentcloud.adobe.com/view-sdk/main.js"></script>
	<script type="text/javascript">
		document.addEventListener("adobe_dc_view_sdk.ready", function () {
			var adobeDCView = new AdobeDC.View({ clientId: "cdd2f1b0e6e84f7a8eb71e7ac84530fa", divId: "adobe-dc-view" });
			adobeDCView.previewFile({
				content: { location: { url: "bodea-summary.pdf" } },
				metaData: { fileName: "Bodea Summary.pdf" }
			}, { showPrintPDF: false, embedMode: "IN_LINE" });
		});
	</script>
</body>
</html>

 

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Hi, thanks for the detailed answer - followed this but still having the issue. I'm able to select Save as PDF in the print dialog and I'm still able to successfully save it and print it using this method. But, specifically through CTRL + P - this method works on File -> Print. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

What browser and OS, include version numbers. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Ends up, I am seeing the behavior described in Safari. The mouse must be over the embedded view when CTRL-P is pressed and it only prints the PDF the first time. The correct behavior happens each subsequent time.

I can see we already have a bug filed against this so stay tuned.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

Hello,

Sorry to hear that you are facing this issue. Which embed mode do you use to display the PDF?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

IN_LINE

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Employee ,
May 31, 2021 May 31, 2021

Copy link to clipboard

Copied

LATEST

We have rolled out a fix for this issue. Please let us know if you still face it. Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines