View | Details | Raw Unified
Collapse All | Expand All

(-) pdftops-1.10 (-6 / +14 lines)
 Lines 5-10    Link Here 
#	Initial implementation
#	Initial implementation
# 1.10 - 2006-09-27/Bl
# 1.10 - 2006-09-27/Bl
#	Alternatively, use Adobe Reader in place of Xpdf's pdftops
#	Alternatively, use Adobe Reader in place of Xpdf's pdftops
# 1.20 - 2007-12-03/Bl
#	Safe temp file creation (fix gentoo bug # 201042)
#
#
# Copyright: Helge Blischke / SRZ Berlin 2004-2006
# Copyright: Helge Blischke / SRZ Berlin 2004-2006
# This program is free seoftware and governed by the GNU Public License Version 2.
# This program is free seoftware and governed by the GNU Public License Version 2.
 Lines 93-99    Link Here 
$default_app = 'use-pdftops';			# the default if both are configured
$default_app = 'use-pdftops';			# the default if both are configured
# ----------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------
use File::Copy;
use File::Temp qw( tempfile );
#
#
# Check which app to use - pdftops or acroread
# Check which app to use - pdftops or acroread
 Lines 149-163    Link Here 
	# as the PDF consumer needs a seekable input.
	# as the PDF consumer needs a seekable input.
	if (! defined $pdffile)
	if (! defined $pdffile)
	{
	{
		my $tmpfile = $ENV{TMPDIR} . "pdfin.$$.tmp";
		my $template = "pdfinXXXXXX";
		open (TEMP, ">$tmpfile") || die ("ERROR: pdftops wrapper: $tmpfile: $!\n");
		my $tmpdir = $ENV{TMPDIR};
		if (! copy (STDIN, TEMP))
		my ($bytes, $buffer);
		my ($tmpfh, $tmpfile) = tempfile ($template, OPEN => 1, DIR => $tmpdir, UNLINK => 0, SUFFIX => '.tmp');
		while (($bytes = read (STDIN, $buffer, 1024)) > 0)
		{
		{
			close (TEMP);
			print $tmpfh "$buffer";
		}
		if ($bytes < 0)
		{
			close ($tmpfh);
			unlink $tmpfile;
			unlink $tmpfile;
			die ("ERROR: pdftops wrapper: $tmpfile: $!\n");
			die ("ERROR: pdftops wrapper: $tmpfile: $!\n");
		}
		}
		close (TEMP);
		close ($tmpfh);
		$pdffile = $tmpfile;
		$pdffile = $tmpfile;
		$delete_input = 1;			# for deleting the temp file after converting
		$delete_input = 1;			# for deleting the temp file after converting
	}
	}