$self->{'tt'} = Template->new({ INCLUDE_PATH => $self->{'cfg'}->param("pdf.include_path"), OUTPUT_PATH => $self->{'cfg'}->param("pdf.tmp_path") }); $self->{'tt'}->process($template,{ field => $field },$self->{'pdf_output'} . '.tex',binmode => 1) || die $self->{'tt'}->error(); my $cwd = cwd(); chdir $self->{'cfg'}->param("pdf.tmp_path"); $ENV{'USER'} = $self->{'cfg'}->param("pdf.user"); $ENV{'HOME'} = $self->{'cfg'}->param("pdf.home"); `latexmk -pdf $tmp_file.tex`; chdir $cwd; rename "$tmp_file.pdf", $file; unlink <$tmp_file.*>; $self->{'pdf_output_file'} = $file; $self->{'pdf_output_file_name'} = $self->{'pdf_output'} . '.pdf';