X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/dc8ffeaa1211987d6b3e0a3f1d2c576c82584d37..5ad4d6d7453a373f12f8e457bc3c3463c946b77f:/SL/DB/Helper/PDF_A.pm diff --git a/SL/DB/Helper/PDF_A.pm b/SL/DB/Helper/PDF_A.pm index 4f5284435..f3388a336 100644 --- a/SL/DB/Helper/PDF_A.pm +++ b/SL/DB/Helper/PDF_A.pm @@ -5,6 +5,27 @@ use strict; use parent qw(Exporter); our @EXPORT = qw(create_pdf_a_print_options); +use Carp; +use Template; + +sub _create_xmp_data { + my ($self, %params) = @_; + + use Cwd; + my $template = Template->new({ + INTERPOLATE => 0, + EVAL_PERL => 0, + ABSOLUTE => 1, + PLUGIN_BASE => 'SL::Template::Plugin', + ENCODING => 'utf8', + }) || croak; + + my $output = ''; + $template->process(SL::System::Process::exe_dir() . '/templates/pdf/pdf_a_metadata.xmp', \%params, \$output) || croak $template->error; + + return $output; +} + sub create_pdf_a_print_options { my ($self) = @_; @@ -20,13 +41,23 @@ sub create_pdf_a_print_options { $::instance_conf->get_company }; + my $timestamp = DateTime->now_local->strftime('%Y-%m-%dT%H:%M:%S%z'); + $timestamp =~ s{(..)$}{:$1}; + return { - version => '3b', - meta_data => { - title => $self->displayable_name, - author => $author, - language => $pdf_language, - }, + version => '3b', + xmp => _create_xmp_data( + $self, + pdf_a_version => '3', + pdf_a_conformance => 'B', + producer => 'pdfTeX', + timestamp => $timestamp, # 2019-11-05T15:26:20+01:00 + meta_data => { + title => $self->displayable_name, + author => $author, + language => $pdf_language, + }, + ), }; }