Drupal is a registered trademark of Dries Buytaert
drupal 11.3.8 Update released for Drupal core (11.3.8)! drupal 11.3.7 Update released for Drupal core (11.3.7)! drupal 11.2.11 Update released for Drupal core (11.2.11)! drupal 10.6.7 Update released for Drupal core (10.6.7)! drupal 10.5.9 Update released for Drupal core (10.5.9)! cms 2.1.1 Update released for Drupal core (2.1.1)! drupal 11.3.6 Update released for Drupal core (11.3.6)! drupal 10.6.6 Update released for Drupal core (10.6.6)! cms 2.1.0 Update released for Drupal core (2.1.0)! video_embed_field 3.1.0 Minor update available for module video_embed_field (3.1.0). bootstrap 8.x-3.40 Minor update available for theme bootstrap (8.x-3.40). menu_link_attributes 8.x-1.7 Minor update available for module menu_link_attributes (8.x-1.7). twig_tweak 4.0.0-alpha1 First alpha version released for module twig_tweak (4.0.0-alpha1). node_revision_delete 2.1.1 Minor update available for module node_revision_delete (2.1.1). commerce_paypal 2.1.2 Minor update available for module commerce_paypal (2.1.2). ckeditor5_premium_features 1.8.1 Minor update available for module ckeditor5_premium_features (1.8.1). ckeditor5_plugin_pack 1.5.2 Minor update available for module ckeditor5_plugin_pack (1.5.2). node_revision_delete 2.1.0 Minor update available for module node_revision_delete (2.1.0). scheduler_content_moderation_integration 3.0.5 Minor update available for module scheduler_content_moderation_integration (3.0.... commerce 3.3.5 Minor update available for module commerce (3.3.5).

This module uses library FPDI Generate a PDF file for printing based on a template.
You can import pages from existing PDF documents.

How to use:

  1. install module fpdi_print with composer require drupal/fpdi_print. It'll add libraries tcpdf & fpdi to vendor
  2. Create view page node with contextual filter (nid)
  3. Add Pdf Print (global) to Header or Footer Views page
    • Fill all the configuration
    • Path to pdf source file - version 1.4. /!\ Check your version pdf before upload, it doesn't work with version 1.5 or 1.6 Path asbolute /var/www/drupal/sites/default/files/template.pdf or relative sites/default/files/template.pdf
    • Add position x,y, text (format array yaml) /!\check validation yaml or /fpdi-print/validate before paste

If you leave the position configuration empty. It'll print contents of the view. You can set pdf header footer with global area custom text from views header footer
Example:

If your fpdf is Form filling and compatible (FPDM)
you can set configuration like this (you don't need position x,y)

- form: "address"
  text: "My city"
- form: "address"
  text: "My phone number"

You can goto page /fpdi-print/validate to check pdf and yaml format

for developper

There is hook fpdi_print_views for alter data positions before generate.
you can call service fpdi_print.print_builder
Format of positions : page number => [ x , y , (text|html|image), height , width]
the page number must start with 1 (NOT BEGIN WITH 0)

/*
$positions = [
 '1' => [
     [ 'x'=> 10, 'y'=>20, 'text'=>'Show text in page 1'],
     [ 'x'=> 15, 'y'=>40, 'height'=>50 , 'width'=>50, 'image'=>101 //you can add fid for image],
     [ 'x'=> 15, 'y'=>50,  'image'=>'/path/to/image' // add image path],
     [ 'x'=> 15, 'y'=>60,  'image'=>'<img src="/path/to/image1.png"/> <img src="/path/to/image2.jpg"/>'// add html multi images],
],
 '2' => [
     [ 'x'=> 10, 'y'=>20, 'height'=> 10, 'html'=>'Show <b>html</b>\n in page 2' ],
]
 '3' => [
     [ 'pdf'=>'/path/to/merge/file.pdf' ],
]
]
*/

    $pdf = \Drupal::service('fpdi_print.print_builder')->getPDF($positions, $filePdfTemplate);

//you can save pdf to file with $pdf->Output('I','yourFileName.pdf');
//or show in directly to browser 
    $response = new StreamedResponse();
    return $response->setCallback(function () use ($pdf) {
      ob_clean();
      $handle = fopen('php://output', 'w+');
      $pdf->Output();
      fclose($handle);
    });

Hook avaible before render pdf


/**
 * Implements hook_fpdi_print_views_alter().
 */
function myModule_fpdi_print_views_alter($dataPositions, $view, $filePdfTemplate){
  $view_id = $view->id();
...
}

Do you like this module? Show your appreciation by buying me ☕.

Activity

Total releases
3
First release
Apr 2026
Latest release
12 hours ago
Release cadence
0 days
Stability
100% stable

Release Timeline

Releases

Version Type Release date
1.1.7 Stable Apr 24, 2026
1.1.6 Stable Apr 24, 2026
1.1.5 Stable Apr 24, 2026