Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 078bf25d

Von Jan Büren vor etwa 3 Jahren hinzugefügt

  • ID 078bf25d3aa259acedb0cdd8905fc3a6e36e874d
  • Vorgänger 8d6e65bb
  • Nachfolger b122ba4c

ReportGenerator: Get PDF as binary (no print, no http-redirect)

Unterschiede anzeigen:

SL/ReportGenerator.pm
486 486
  };
487 487

  
488 488
  my $self       = shift;
489
  my %params     = @_;
489 490
  my $variables  = $self->prepare_html_content();
490 491
  my $form       = $self->{form};
491 492
  my $myconfig   = $self->{myconfig};
......
718 719
    $content = $self->append_gl_pdf_attachments($form,$content);
719 720
  }
720 721

  
722
  # 1. check if we return the report as binary pdf
723
  if ($params{want_binary_pdf}) {
724
    return $content;
725
  }
726
  # 2. check if we want and can directly print the report
721 727
  my $printer_command;
722 728
  if ($pdfopts->{print} && $pdfopts->{printer_id}) {
723 729
    $form->{printer_id} = $pdfopts->{printer_id};
724 730
    $form->get_printer_code($myconfig);
725 731
    $printer_command = $form->{printer_command};
726 732
  }
727

  
728 733
  if ($printer_command) {
729 734
    $self->_print_content('printer_command' => $printer_command,
730 735
                          'content'         => $content,
......
732 737
    $form->{report_generator_printed} = 1;
733 738

  
734 739
  } else {
740
  # 3. default: redirect http with file attached
735 741
    my $filename = $self->get_attachment_basename();
736 742

  
737 743
    print qq|content-type: application/pdf\n|;
......
975 981

  
976 982
The PDF generation function. It is invoked by generate_with_headers and renders the PDF with the PDF::API2 library.
977 983

  
984
If the param want_binary_pdf is set, the binary pdf stream will be returned.
985
If $pdfopts->{print} && $pdfopts->{printer_id} are set, the pdf will be printed (output is directed to print command).
986

  
987
Otherwise and the default a html form with a downloadable file is returned.
988

  
978 989
=item generate_csv_content
979 990

  
980 991
The CSV generation function. Uses XS_CSV to parse the information into csv.

Auch abrufbar als: Unified diff