Skip to main content
Drupal is a registered trademark of Dries Buytaert
Release: OpenID Connect / OAuth client 3.0.0-alpha9 New alpha version released for module openid_connect (3.0.0-alpha9). Release: Timelinr 1.0.1 Minor update available for module timelinr (1.0.1). Usage Milestone: Simplify Module simplify crossed 10,000 active installs. Usage Milestone: Views Reference Filter Module entityreference_filter crossed 10,000 active installs. Usage Milestone: Dropdown Language Module dropdown_language crossed 10,000 active installs. Usage Milestone: Paragraphs Browser Module paragraphs_browser crossed 10,000 active installs. Usage Milestone: OpenAPI Module openapi crossed 10,000 active installs. Usage Milestone: Decoupled Router Module decoupled_router crossed 10,000 active installs. Usage Milestone: Time Field for Drupal 8+ Module time_field crossed 10,000 active installs. Module Revived: Entityqueue Buttons 1.1.2 Module entityqueue_buttons updated after 8 months of inactivity (1.1.2).

Go-WkhtmltoX

1 sites Security covered
View on drupal.org

This module integrates Drupal with Go-WkhtmltoX, enabling the conversion of content to PDF or image formats.

This module integrates Drupal with Go-WkhtmltoX.

Installation

Install as usual, see Installing Drupal 8 Modules or Installing modules' Composer dependencies for further information.

Configuration

Add your endpoint to your settings.php

$config['go_wkhtmltox.settings']['endpoint'] = 'http://wkhtmltox:8080';

PDF example

use Drupal\go_wkhtmltox\API\Converter\ToPdfConverter;
use Drupal\go_wkhtmltox\API\Fetcher\DataFetcher;

$pdf = [
 '#type' => 'inline_template',
 '#template' => '<h1>Hello world!</h1>',
];

$pdf_data = (string) \Drupal::service('renderer')->renderPlain($pdf);
$converter = new ToPdfConverter();
$converter->setOption('extend', [
  'dpi' => '300',
  'image-dpi' => '300',
  'image-quality' => '100',
  'page-width' => '210mm',
  'page-height' => '297mm',
]);
$fetcher = new DataFetcher();
$fetcher->setParam('data', $pdf_data);
$pdf_file = \Drupal::service('go_wkhtmltox.client')->convert($converter, $fetcher);

Image example

use Drupal\go_wkhtmltox\API\Converter\ToImageConverter;
use Drupal\go_wkhtmltox\API\Fetcher\DataFetcher;

$pdf = [
  '#type' => 'inline_template',
  '#template' => '<h1>Hello world!</h1>',
];

$pdf_data = (string) \Drupal::service('renderer')->renderPlain($pdf);
$converter = new ToImageConverter();
$converter->setOption('format', 'png');
// Sets the minimum value, it'll be auto-calculated.
$converter->setOption('width', 0);
$converter->setOption('extend', [
  'transparent' => '--transparent',
  // This option isn't added by itself.
  // @see https://github.com/gogap/go-wkhtmltox/issues/8
  'quality' => '0',
]);
$fetcher = new DataFetcher();
$fetcher->setParam('data', $pdf_data);
$pdf_file = \Drupal::service('go_wkhtmltox.client')->convert($converter, $fetcher);

Sponsors

- Fundación UNICEF Comité Español

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
2
Tracked since
Sep 2025
Latest release
4 months ago
Releases (12 mo)
2 ▲ from 0
Maintenance
Active

Releases

Version Type Core Release date
1.0.0-beta2 Pre-release 10–11 Apr 28, 2026
1.0.0-beta1 Pre-release 8–10 Sep 26, 2025