NAME
Catalyst::View::Wkhtmltopdf - Catalyst view to convert HTML (or TT) content to PDF using wkhtmltopdf
STATUS
The wkhtmltopdf project is no longer being maintained, and this module will be deprecated in a later release.
See "SECURITY CONSIDERATIONS".
SYNOPSIS
# lib/MyApp/View/Wkhtmltopdf.pm
package MyApp::View::Wkhtmltopdf;
use Moose;
extends qw/Catalyst::View::Wkhtmltopdf/;
__PACKAGE__->meta->make_immutable();
1;
# configure in lib/MyApp.pm
MyApp->config({
...
'View::Wkhtmltopdf' => {
command => '/usr/local/bin/wkhtmltopdf',
# Guessed via File::Spec by default
tmpdir => '/usr/tmp',
# Name of the Template view, "TT" by default
tt_view => 'Template',
},
});
sub ciao : Local {
my($self, $c) = @_;
# Pass some HTML...
$c->stash->{wk} = {
html => $web_page,
};
# ..or a TT template
$c->stash->{wk} = {
template => 'hello.tt',
page_size => 'a5',
};
# More parameters...
$c->stash->{wk} = {
html => $web_page,
disposition => 'attachment',
filename => 'mydocument.pdf',
};
$c->forward('View::Wkhtmltopdf');
}
DESCRIPTION
Catalyst::View::Wkhtmltopdf is a Catalyst view handler that
converts HTML data to PDF using wkhtmltopdf.
It can also handle direct conversion of Template-Toolkit templates via Catalyst::View::TT.
RECENT CHANGES
Changes for version v0.6.0 (2026-07-24)
- Security
- Fix potential shell command injection from arguments (CVE-2026-16766).
- Enhancements
- Return a filehandle instead of the PDF contents
- The command attribute was changed to use File::Which to guess the patch of wkhtmltopdf.
- Added support for additional options. (See documentation)
- Internal code improvements.
- The HTML is read as raw bytes.
- Documentation
- Updated AUTHOR with maintainer.
- Added STATUS and SECURITY CONSIDERATIONS sections about wkhtmltopdf no longer being maintained.
- Updated the link to the wkhtmltopdf project.
- Documented release dates in Changes.
- Tests
- Added simple test.
- Toolchain
- Revised Dist::Zilla configuration.
See the Changes file for more details.
REQUIREMENTS
wkhtmltopdf must be installed.
This module lists the following modules as runtime dependencies:
- Catalyst::View
- Catalyst::View::TT
- File::Spec
- File::Temp
- File::Which
- IO::File::WithPath
- IPC::Run3
- Moose
- URI::Escape
- namespace::autoclean
- strict
- version version 0.77 or later
- warnings
See the cpanfile file for the full list of prerequisites.
INSTALLATION
The latest version of this module (along with any dependencies) can be installed from CPAN with the cpan tool that is included with Perl:
cpan Catalyst::View::Wkhtmltopdf
You can also extract the distribution archive and install this module (along with any dependencies):
cpan .
You can also install this module manually using the following commands:
perl Makefile.PL
make
make test
make install
If you are working with the source repository, then it may not have a Makefile.PL file. But you can use the Dist::Zilla tool in anger to build and install this module:
dzil build
dzil test
dzil install --install-command="cpan ."
For more information, see How to install CPAN modules.
SECURITY CONSIDERATIONS
Do not use wkhtmltopdf with untrusted HTML.
The wkhtmltopdf project is no longer being maintained, and the underlying QtWebKit libraries that it uses have been unsupported since 2015.
The git repository was archived as read-only in 2023.
You should consider migrating to alternative solutions.
SUPPORT
Only the latest version of this module will be supported.
Future releases may only support Perl versions released in the last ten (10) years.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Catalyst-View-Wkhtmltopdf
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Reporting Security Vulnerabilities
If the bug you are reporting has security implications which make it inappropriate to send to a public issue tracker,
then see SECURITY.md for instructions how to report security vulnerabilities.
SOURCE
The development version is on github at https://github.com/robrwo/Catalyst-View-Wkhtmltopdf and may be cloned from https://github.com/robrwo/Catalyst-View-Wkhtmltopdf.git
Note that the git repository has changed since version v0.6.0.
AUTHOR
Michele Beltrame mb@italpro.net
This module is currently maintained by Robert Rothenberg perl@rhizomnic.com.
CONTRIBUTORS
- Jens Gassmann jens.gassmann@atomix.de
- Robert Rothenberg perl@rhizomnic.com
COPYRIGHT AND LICENSE
This software is copyright (c) 2011-2018, 2026 by Michele Beltrame mb@italpro.net.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.