• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Disabled Printing but CTRL + P still prints

Community Beginner ,
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

2.3K

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
Community Expert ,
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>

 

 

Votes

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
Community Beginner ,
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. 

Votes

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
Community Expert ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

What browser and OS, include version numbers. 

Votes

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
Community Expert ,
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.

Votes

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
Community Beginner ,
Oct 04, 2023 Oct 04, 2023

Copy link to clipboard

Copied

Hay una actualizacion con respecto a este tema

Votes

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
Community Beginner ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

Hi Joel,
I am observing the same bug on latest version of Chrome as well. Already tried the suggested solution but in vain.
I see that this conversation is quite old but can you shed some light on this one ?

Thanks !

Votes

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
Community Beginner ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

He resuelto el tema hasta ahora protegiendo el archivo con "PDF Services API"

 

carlosadalid5E27_0-1697546426916.png

de esta manera al generar el PDF le quito el permiso de imprimir "Protect PDF"
https://developer.adobe.com/document-services/docs/overview/pdf-services-api/howtos/protect-pdf/
y al abrir el PDF muestra el siguiente resultado

carlosadalid5E27_1-1697546615252.png

 

de la misma manera adobe deja algunos ejemplos de como hacerlo para este caso con JAVA

https://github.com/adobe/pdfservices-java-sdk-samples

 

Votes

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
Community Beginner ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

I'll give this a try. Thanks !

Votes

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
Community Beginner ,
Feb 14, 2024 Feb 14, 2024

Copy link to clipboard

Copied

The problem now is that we are not using any of the supported backend tech. This workaround won't solve the issue for us. I am more curious about a response from @Joel_Geraci / @Sumona Ghosh now.

Votes

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
Community Beginner ,
Feb 15, 2024 Feb 15, 2024

Copy link to clipboard

Copied

Anything @Sumona Ghosh / @Joel_Geraci ?

Votes

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 ,
Apr 24, 2024 Apr 24, 2024

Copy link to clipboard

Copied

Hi, Any update on this? I have followed this but still facing the issue [chrome].

Votes

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?

Votes

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
Community Beginner ,
May 06, 2021 May 06, 2021

Copy link to clipboard

Copied

IN_LINE

Votes

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

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

Votes

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
Community Beginner ,
Sep 27, 2023 Sep 27, 2023

Copy link to clipboard

Copied

Hi, I still having the same problem as @defaultbssold8ngxvl.

Votes

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
Community Beginner ,
Sep 27, 2023 Sep 27, 2023

Copy link to clipboard

Copied

@Joel_Geraci I'm using SIZED_CONTAINER.

Votes

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 15, 2024 May 15, 2024

Copy link to clipboard

Copied

I solved this by Capturing PDF Embed API Events, when a user try to print it returns a "DOCUMENT_PRINT" type event, so there u can handle it.
Keep in mind that this is a callback, so the printing cannot be stopped by setting an event.preventdefault, my solution has been to reload the page so the printing is cancelled, it is not the cleanest solution but it is the only one that I have found.
Heres a code example:

        adobeDCView.registerCallback(
        AdobeDC.View.Enum.CallbackType.EVENT_LISTENER,
        function (event) {
            if(event.type === "DOCUMENT_PRINT"){
                location.reload();
            }
        },
        {
            enablePDFAnalytics: true,
        }
    );

Votes

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 27, 2024 May 27, 2024

Copy link to clipboard

Copied

LATEST

Thankyou

Votes

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
Resources