Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > distiller page size problem
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 23rd April 03:13
joerg.drees
External User
 
Posts: 1
Default distiller page size problem



using distiller 3 on solaris got following problem. with eps files
with tiff preview (necessary to use that type) with larger sizes the
tiff header is to large that distiller cant use the dsc bounding box
to determ pagesize. all the stuff is printed in bottom left corner on
default pagesize.

using epstool -p got problems with compiler and lib versions

searching for command line tool to extract postscript tail and only
distill that part

any suggestions?
  Reply With Quote


  sponsored links


2 23rd April 03:13
helge blischke
External User
 
Posts: 1
Default distiller page size problem



In the attachment find a filter program (written for the CUPS
printing system and thus freely available under the GPL) which
extracts the PostScript part out of such a beast.
As it is a Perl script, you can easily modify it to match your
needs.

Helge


--
H.Blischke@srz-berlin.de
H.Blischke@srz-berlin.com
H.Blischke@acm.org

#!/usr/bin/perl -w
# epsftoeps - a CUPS filter to convert an EPSF (eps file with DOS preview) to a plain EPS file
# ------------------------------------------------------------------------------------------------
# Copyright 2003 SRZ BERLIN/Bl
#
# Distribution and use of this code are governed by the
# Common UNIX Printing System License Agreement
# as defined in the file LICENSE.txt of the CUPS
# distribution.
#
# 1.00 - 2003-08-15/Bl
# initial implementation

#
# Check correct number of arguments
#
die ("ERROR: wrong number of arguments\n") if ($#ARGV < 4);
# Prevent Perl from complaining
$job_id = $job_copies = 0;
$job_user = $job_title = $job_options = '';

#
# Get command line arguments (if used or not)
#
$job_id = shift; # job identification
$job_user = shift; # user name who submitted job
$job_title = shift; # job title
$job_copies = shift; # number of required copies
$job_options = shift; # the huge string of subitted options
$epsname = shift; # input file name
$tmpdir = $ENV{TMPDIR};
$tmpdir = '/var/tmp' if (! defined $tmpdir);

#
# Do we read from a plain file or from stdin?
#
if (defined $epsname)
{
if (! open (EPSF, "$epsname"))
{
warn ("ERROR: File \'$epsname\': $!\n");
exit 1;
}
}
else
{
if (! open (EPSF, "<&STDIN"))
{
warn ("ERROR: dup stdin: $!\n");
exit 1;
}
}
#
# Initialize vars
#
$buffer = '';
($ofs, $len) = (0,0);

#
# Read and check the EPSF header
#
$bytes = read (EPSF, $buffer, 30);
if (! defined $bytes)
{
warn ("ERROR: ", (defined $epsname) ? "\'$epsname\'" : "stdin", ": $!\n");
exit 1;
}
if ($bytes != 30)
{
warn ("ERROR: ", (defined $epsname) ? "\'$epsname\'" : "stdin", ": incomplete EPSF header\n");
exit 1;
}
# We only need the PostScript part of the input
(my $dummy, $ofs, $len) = unpack ("H8VV", $buffer);

#
# From just behind the header, skip to the beginning of the PostScript part
#
if (defined $epsname)
{
if (! seek (EPSF, $ofs, 0))
{
warn ("ERROR: File \'$epsname\': $!\n");
exit 1;
}
}
else
{
# We assume that the preview is sufficiently small to fit into memory
# if it precedes the PostScript part
my $to_skip = $ofs - 30;
if ($to_skip > 0)
{
$bytes = read (EPSF, $buffer, $to_skip);
if (! defined $bytes)
{
warn ("ERROR: stdin: $!\n");
exit 1;
}
if ($bytes != $to_skip)
{
warn ("ERROR: stdin: read only $bytes bytes (should be $to_skip)\n");
exit 1;
}
}
}

#
# Now read the PostScript part in suitable chunks and write it to stdout # $bytes = 0;
while ($len > 0)
{
my $chunk = read (EPSF, $buffer, ($len < 16384) ? $len : 16384);
if (! defined $chunk)
{
warn ("ERROR: ", (defined $epsname) ? "\'$epsname\'" : "stdin", ": at pos. ", $ofs+$bytes, ": $!\n");
exit 1;
}
if ($chunk <= 0)
{
warn ("ERROR: ", (defined $epsname) ? "\'$epsname\'" : "stdin", ": premature EOF at pos. ", $ofs+$bytes, "; ", $len-$bytes, " missing\n");
exit 1;
}
if ($bytes == 0)
{
# At the beginning of the EPS file, make sure the pstops filter will recognize this
# as an EPS file ...
if ($buffer =~ /^%!(.*)([\n\r])/)
{ # It IS kind of PostScript
my $temp = $1;
my $eol = $2;
undef my $oky;
$oky = $1 if ($temp =~ /(EPS)/);
if (! defined $oky)
{
$buffer =~ s/$eol/% EPS $eol/;
}
}
if ($buffer =~ /%%BoundingBox:\s+([0-9\.]+)\s+([0-9\.]+)\s+([0-9\.]+)\s+([0-9\.]+)\s*[\n\r]/)
{
# Though it is illegal, we'll accept real numbers in bounding box
my ($llx, $lly, $urx, $ury) = ($1, $2, $3, $4);
my $imw = $urx - $llx;
my $imh = $ury - $lly;
print "%!PS-Adobe-3.0 EPSF 3.0\n";
print "%%BoundingBox: $llx $lly $urx $ury\n";
print "%%EndComments\n";
print "currentpagedevice/PageSize get aload pop\n";
print "$imh sub 2 div $lly sub exch $imw sub 2 div $llx sub exch translate\n";
}
}
$bytes += $chunk;
$len -= $chunk;
print "$buffer";
}
print ("\n");
close (EPSF) if (defined $epsname);
exit 0;
  Reply With Quote
3 2nd May 12:41
russell lang
External User
 
Posts: 1
Default distiller page size problem


Try using the latest version of epstool, and follow the
instructions in doc/epstool.htm for how to compile it.
  Reply With Quote
Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666