Skip to main content
drupalreleases

Use direct release data with your AI assistant.

Learn more

Partial Page Print

Security covered Under active development 59 sites

Part of the Partial ecosystem · 5 projects

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>
Drupal 9–11

Ask your assistant about Partial Page Print

Check compatibility with your Drupal and PHP version, maintenance and security coverage, from current release data. How it works

Depends on

Dependencies of the latest stable release

No dependencies recorded for this project.

Required by

Tracked projects that depend on this one

No tracked projects depend on this one yet.

Activity

Tracked releases
7
Tracked since
May 2023
Latest release
1 year ago
Releases (12 mo)
0 ▼ from 1
Maintenance
Slowing

Release Timeline

Releases

Version Type Core PHP Release date
1.2.0 Stable 9–11 Jul 10, 2025
1.1.1 Stable 9–10 PHP 8.1 Nov 22, 2023
1.1.0 Stable 9–10 PHP 8.1 Nov 9, 2023
1.0.2 Stable 9–10 PHP 8.1 Sep 18, 2023
1.0.1 Stable 9–10 PHP 8.1 Sep 6, 2023
1.0.0 Stable 9–10 PHP 8.1 May 19, 2023
1.0.x-dev Dev 9–11 PHP 8.1 May 19, 2023