1 package SL::DB::Helper::PDF_A;
5 use parent qw(Exporter);
6 our @EXPORT = qw(create_pdf_a_print_options);
11 sub _create_xmp_data {
12 my ($self, %params) = @_;
14 my $template = Template->new({
18 PLUGIN_BASE => 'SL::Template::Plugin',
23 $template->process(SL::System::Process::exe_dir() . '/templates/pdf/pdf_a_metadata.xmp', \%params, \$output) || croak $template->error;
28 sub create_pdf_a_print_options {
31 require SL::DB::Language;
33 my $language_code = $self->can('language_id') && $self->language_id ? SL::DB::Language->load_cached($self->language_id)->template_code : undef;
34 $language_code ||= 'de';
35 my $pdf_language = $language_code =~ m{deutsch|german|^de$}i ? 'de-DE'
36 : $language_code =~ m{englisch|english|^en$}i ? 'en-US'
40 $::instance_conf->get_company
43 my $timestamp = DateTime->now_local->strftime('%Y-%m-%dT%H:%M:%S%z');
44 $timestamp =~ s{(..)$}{:$1};
48 xmp => _create_xmp_data(
51 pdf_a_conformance => 'B',
53 timestamp => $timestamp, # 2019-11-05T15:26:20+01:00
55 title => $self->displayable_name,
57 language => $pdf_language,
60 conformance_level => 'EXTENDED',
61 document_file_name => 'ZUGFeRD-invoice.xml',
62 document_type => 'INVOICE',