Drupal is a registered trademark of Dries Buytaert
Protected Pages 3.0.0 Major update available for module protected_pages (3.0.0). Commerce Core 3.3.8 Minor update available for module commerce (3.3.8). Search API HTML Element Filter 1.0.7 Minor update available for module search_api_html_element_filter (1.0.7). Layout Builder Reorder 2.0.1 Minor update available for module layout_builder_reorder (2.0.1). Ban 1.1.0 Minor update available for module ban (1.1.0). Field Formatter Range 2.0.0 Major update available for module field_formatter_range (2.0.0). Field Formatter Range 8.x-1.8 Minor update available for module field_formatter_range (8.x-1.8). Varbase Media Header 9.2.1 Minor update available for module varbase_media_header (9.2.1). Search API Solr 4.3.11 Module search_api_solr updated after 14 months of inactivity (4.3.11). Provus Mega Menu Module provus_mega_menu crossed 1,000 active installs.

Partial Page Print

37 sites Security covered
View on drupal.org

This module adds a button allowing visitors to print only specific parts of a web page. The printed output will retain the site's theme but exclude unwanted page elements.

Add a button to your page to allow visitors to print part of the current page.

The printed page would use the same theme but without any of the regions, blocks, or other parts of the page that are not desired on the printed page.

Requirements

This module requires no modules outside of Drupal core.

Installation

Install with composer: composer require drupal/partial_page_print then enable the module.

Using

To add the print button to a page, add the following element to the render array in your custom module or with a preprocess hook in your theme. Be sure that the #element_id is populated with the HTML ID of the thing you want to be printed on the page.

 $build['print_link'] = [
   '#value' => $this->t('Print the Content'),
   '#type' => 'partial_page_print_button',
   '#element_id' => 'my_div_id',
 ];

Example

Example of adding the partial page print button to a node template in your site's theme:

In your theme's .theme file:

function function MYTHEME_preprocess_node(&$variables) {
 $variables['nodeSummaryPrintButton'] = [
   '#value' => $this->t('Print Summary'),
   '#type' => 'partial_page_print_button',
   '#element_id' => 'node-summary',
 ];
}

In your theme's node template:

<article>
  {# ... #}
  {{ nodeSummaryPrintButton }}
  <div>
    {# Node summary here #}
  </div>
  {# ... #}
</article>

Activity

Total releases
1
First release
Jul 2025
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Dormant

Releases

Version Type Release date
1.2.0 Stable Jul 10, 2025