Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: Views Bootstrap 5.5.4 — Minor update available for module views_bootstrap (5.5.4). Release: Download Tracker 1.0.7 — Minor update available for module download_tracker (1.0.7). Release: Directory2Block Slideshow 1.0.8 — Minor update available for module directory2block_slideshow (1.0.8). Release: Mautic Audiences 1.1.5 — Minor update available for module mautic_audiences (1.1.5). Release: Rightup theme 1.0.3 — Minor update available for theme vartheme_bs5_rightup (1.0.3). Release: CommentOn 1.0.6 — Minor update available for module commenton (1.0.6). Release: ChatGPT Ads 1.0.3 — Minor update available for module chatgpt_ads (1.0.3). Release: Opensolr Search 5.1.3 — Minor update available for module opensolr_search (5.1.3). Module Revived: Swagger-PHP OpenAPI 3 documentation generator 1.0.0 — Module swagger_php updated after 10 months of inactivity (1.0.0). Security Coverage: Microsoft Azure AI — Module ai_provider_azure now has official Drupal security advisory coverage.

PDF Tools

No security coverage

Part of the PDF ecosystem · 16 projects

View on drupal.org

PDF Tools is a drupal module to make it easier to manipulate PDF files. It provides service definitions and interfaces
for PDF generation, manipulation, analysis and conversion. The default implementations of these services use local
command-line tools, contrib modules provide alternative implementations.

Generation

The pdf_tools.generator service handles the generation of PDF's from html content. The default implementation requires wkhtmltopdf is installed on the local machine. The pdf_tools_docker module provides an alternative implementation utilising the wkhtmltopdf container available on the docker network.

Example

// Convert an entity to a PDF file.
$generator = \Drupal::service('pdf_tools.generator');
$pdf_uri = $generator->entityToPDF($entity_load, 'view_mode', $options);

Alternatively we can convert a URL to a pdf.

// Convert an entity to a PDF file.
$generator = \Drupal::service('pdf_tools.generator');
$uri = $generator->generateFromUrl(
  Url::fromRoute(
    'entity.node.canonical',
    [
      'node' => 1,
    ],
    [
      'absolute' => TRUE,
    ]
  )->toString(),
  $options
);

Analysis

The pdf_tools.analyser service provides methods that extract information from PDF files. The default implementation
uses pdftk in the local command line.

Example

// Get the number of pages in the pdf document.
$analyser = \Drupal::service('pdf_tools.analyser');
$num_pages = $analyser->countPages('private://path/my.pdf');

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
3
Tracked since
May 2023
Latest release
3 years ago
Releases (12 mo)
0
Maintenance
Dormant

Release Timeline

Releases

Version Type Core Release date
2.0.0-alpha2 Pre-release May 15, 2023
2.0.0-alpha1 Pre-release May 15, 2023
2.x-dev Dev May 15, 2023