62
Views
17
Comments
[Ultimate PDF] Hide other objects inside before Printing PDF
ultimate-pdf
Reactive icon
Forge asset by Leonardo Fernandes
Application Type
Reactive
Service Studio Version
11.54.39 (Build 63034)
Platform Version
11.25.0 (Build 41743)

I am using ULtimate PDF for the preview PDF. the code i use "window.print();" for my print and the problem is when i'm clicking the print button. the download and print button is joining to the print. is there a way i can hide the print and download button when im printing the actual pdf? thank you


2019-09-30 07-35-56
Aurelio Junior

Hello,

You can hide elements from your page when in print mode using CSS media queries. For instance, adding this CSS to your theme will hide all elements with the "btn" class when printing the page:

@media print {
    .btn {
        visibility: hidden;
    }
}

UserImage.jpg
budang haba

it actually worked it is hidden but the page is still giving extra 

2019-09-30 07-35-56
Aurelio Junior
2023-04-17 05-19-55
Vaishali Shrivastava

Hi @budang haba ,


You can try using the HideOnPrint block available in the UltimatePDF module.

The element defined inside the HideOnPrint block's content placeholder will not be visible on print media. 


Hope this will help you!

UserImage.jpg
budang haba

hi! how can i use this?

2023-04-17 05-19-55
Vaishali Shrivastava

Hi,


You can simply drag and drop the web block on your screen and place the content that you want to hide while printing the pdf. In your case, the print button 

2023-04-17 05-19-55
Vaishali Shrivastava

If possible can you please attach the oml file here.

UserImage.jpg
budang haba

have you tried printing your example? because for me it doesnt work for me

2023-04-17 05-19-55
Vaishali Shrivastava

Hi, 


Please use PrintLayout from ultimate pdf module, and place the hideOnPrint inside it. It should work for you


Please check attached oml file


pdf_Demo.oml
2025-12-30 15-52-56
ATUL TIWARI
2024-05-08 06-29-37
Prince Aadil Khan Panwar

hi @budang haba 

put thoes button in container and give it name and use this javascript to hide this container

let get = document.getElementById(container id); // pass the id by input of the javascript 

get.style.visibility = 'hidden';

after that call the window.print() function. 

definitely it will work. hope this helps 

Thanks

Prince



UserImage.jpg
budang haba

i tried this but does not work

2024-05-08 06-29-37
Prince Aadil Khan Panwar


let get = document.getElementById(container id); // pass the id by input of the javascript 

get.style.visibility = 'hidden';

try this javascript or try to attach oml i will look into

UserImage.jpg
budang haba
2024-05-08 06-29-37
Prince Aadil Khan Panwar
UserImage.jpg
budang haba

cant share it due to intellectual property

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.