0N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License (the "License").
0N/A# You may not use this file except in compliance with the License.
0N/A#
0N/A# You can obtain a copy of the license at CDDL.LICENSE.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at CDDL.LICENSE.
0N/A# If applicable, add the following below this CDDL HEADER, with the
0N/A# fields enclosed by brackets "[]" replaced with your own identifying
0N/A# information: Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
0N/A
0N/A#
0N/A# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
0N/A# Use is subject to license terms.
0N/A#
0N/A
0N/A#
0N/A# This script reads a PostScript file and adds commands which inform an HP
0N/A# DesignJet (5500ps, though it also works on an 800ps, too) of the size of the
0N/A# page. Otherwise, it won't print more than about 50" long.
0N/A#
0N/A
0N/A# Not sure if this is exactly the right size, or if it will always precede
0N/A# BeginSetup, but it works for dot-produced .ps files.
0N/A/^%%BoundingBox:/ { width = $4; height = $5 }
0N/A
0N/A/^%%BeginSetup$/ {
0N/A if (width == 0 || height == 0) {
0N/A exit 1;
0N/A }
0N/A print;
0N/A
0N/A # I doubt this is necessary, but the PPD spec suggests it.
0N/A print "%%BeginFeature: *CustomPageSize";
0N/A
0N/A # Here we print the parameters to the code below. We add an inch of
0N/A # 'far' margin (the 'near' margin should have already been set by dot
0N/A # to be whatever margin was set to in the .dot file).
0N/A printf "%d %d\n", width + 72, height + 72;
0N/A
0N/A # This is the magic code from HP's ppd file. Actually, the ppd code
0N/A # begins with pop pop pop, but that just discards the orientation and
0N/A # offset parameters, so if we don't print them in the first place, it
0N/A # won't matter.
0N/A print "<</PageSize [ 5 -2 roll ] /ImagingBBox null>>setpagedevice";
0N/A
0N/A print "%%EndFeature";
0N/A next;
0N/A}
0N/A
0N/A{ print }