X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDB%2FHelper%2FPDF_A.pm;h=467d4c11ad238c327f5c41a63f42271bb783e122;hb=ba40069b4f465cd51d509ab280d1c6e61652bda9;hp=4f52844350033fdf7476d7a276d423cac77eae05;hpb=80eceeda50a7c64673a6f3b41df4dbaa388db2da;p=kivitendo-erp.git diff --git a/SL/DB/Helper/PDF_A.pm b/SL/DB/Helper/PDF_A.pm index 4f5284435..467d4c11a 100644 --- a/SL/DB/Helper/PDF_A.pm +++ b/SL/DB/Helper/PDF_A.pm @@ -5,6 +5,26 @@ 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) = @_; + + 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 +40,29 @@ 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, + }, + zugferd => { + conformance_level => 'EXTENDED', + document_file_name => 'factur-x.xml', + document_type => 'INVOICE', + version => '1.0', + }, + ), }; }