Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 5e9f08d4

Von Moritz Bunkus vor mehr als 4 Jahren hinzugefügt

  • ID 5e9f08d41ced9d75d868621c43b9b639e9e1b781
  • Vorgänger ac51747a
  • Nachfolger e7e3b8f9

ZUGFeRD: nicht nach \documentclass, sondern \begin{document} suchen

\documentclass steht evtl. in einem Include.

Unterschiede anzeigen:

SL/Template/LaTeX.pm
428 428
    if ($line =~ m/\\usepackage[^\{]*{(.*?)}/) {
429 429
      $used_packages{$1} = 1;
430 430

  
431
    } elsif (($line =~ m/\\documentclass/) && $self->{pdf_a}) {
432
      my $version = $self->{pdf_a}->{version}   // '3a';
433

  
434
      if ($self->{pdf_a}->{xmp}) {
431
    } elsif ($line =~ m/\\begin\{document\}/) {
432
      if ($self->{pdf_a} && $self->{pdf_a}->{xmp}) {
433
        my $version       = $self->{pdf_a}->{version}   // '3a';
435 434
        my $xmp_file_name = $self->{userspath} . "/pdfa.xmp";
436 435
        my $out           = IO::File->new($xmp_file_name, ">:encoding(utf-8)") || croak "Error creating ${xmp_file_name}: $!";
437 436
        $out->print(Encode::encode('utf-8', $self->{pdf_a}->{xmp}));
438 437
        $out->close;
439 438

  
440
      } else {
441
        my $meta = $self->{pdf_a}->{meta_data} // {};
442

  
443 439
        push @new_lines, (
444
          "\\RequirePackage{filecontents}\n",
445
          "\\begin{filecontents*}{\\jobname.xmpdata}\n",
446
          ($meta->{title}    ? sprintf("\\Title{%s}\n",    $meta->{title})    : ""),
447
          ($meta->{author}   ? sprintf("\\Author{%s}\n",   $meta->{author})   : ""),
448
          ($meta->{language} ? sprintf("\\Language{%s}\n", $meta->{language}) : ""),
449
          "\\end{filecontents*}\n",
440
          "\\usepackage[a-${version},mathxmp]{pdfx}[2018/12/22]\n",
441
          "\\usepackage[genericmode]{tagpdf}\n",
442
          "\\tagpdfsetup{activate-all}\n",
443
          "\\hypersetup{pdfstartview=}\n",
450 444
        );
451 445
      }
452 446

  
453
      push @new_lines, (
454
        $line,
455
        "\\usepackage[a-${version},mathxmp]{pdfx}[2018/12/22]\n",
456
        "\\usepackage[genericmode]{tagpdf}\n",
457
        "\\tagpdfsetup{activate-all}\n",
458
        "\\hypersetup{pdfstartview=}\n",
459
      );
460

  
461
      next;
462

  
463
    } elsif ($line =~ m/\\begin\{document\}/) {
464 447
      push @new_lines, map { "\\usepackage{$_}\n" } grep { !$used_packages{$_} } @required_packages;
465 448
      push @new_lines, $line;
466 449
      push @new_lines, map { $self->_embed_file_directive($_) } @{ $self->{pdf_attachments} // [] };

Auch abrufbar als: Unified diff