in reply to Re: create ps file with PostScript::Simple - cannot print it out?
in thread create ps file with PostScript::Simple - cannot print it out?

Thanks so much for pointing this out
You're right.
I didn't know about the showpage event missing in the EPS file.

Do you know how to scale everything in the pagesize? Even though I specified it, I still missed few lines on the top and footer.

Again , thanks
  • Comment on Re^2: create ps file with PostScript::Simple - cannot print it out?

Replies are listed 'Best First'.
Re^3: create ps file with PostScript::Simple - cannot print it out?
by almut (Canon) on Jul 17, 2008 at 20:49 UTC
    Do you know how to scale everything in the pagesize

    Either scale your EPS object ($e) as needed, and then place it slightly above y-pos zero (unless the origin is translated, [0,0] coincides with the physical left/bottom borders of the page (no margins), but most printers cannot fill the entire page, due to construction limits).  For example:

    my $e = new PostScript::Simple::EPS(file => "body.eps", colour=>1); $e->scale(0.95); ... $p->importeps($e, 0,40);

    Or use the alternative method importepsfile(...), which allows you to specify the lower left and upper right corner of a rectangle on the page into which the EPS content will be fit (i.e. autoscaled), e.g.

    $p->importepsfile({overlap => 1}, "body.eps", 200,40, 200,800);

    overlap => 1 keeps the aspect ratio as is, i.e. in this case, scaling will be done by the height (800 - 40 = 760), while the width (200 - 200 = 0) will be ignored.

    (BTW, the former method seems to have a bug (or peculiarity) if the lower left corner of the EPS bounding box isn't 0,0 (in your case it's 238,1 for example — which is fine per se). In that case, this bounding box offset is added to the position that you specify with importeps(). This doesn't make much sense, IMHO, as you'll need to know the bounding box coordinates to position the thing in a predictable way — which makes it unnecessarily cumbersome...   (the importepsfile() method, OTOH, does handle this correctly, apparently).)

      The eps file "body.eps" is used for testing only.
      But in my main program I have to a import 2 eps files : header and body. And I cannot control their sizes. If I adjust manually, there's certainly new case coming out of control.
        And I cannot control their sizes

        With the importepsfile() method you do have autoscaling... you just need to specify the respective areas on the page where the imported EPS files are supposed to appear.

        If you know nothing about the shape of the EPS objects and still want a nice layout, however, you'll have to devise an algorithm (or maybe find a module on CPAN) that computes the optimal placement on the page.  AFAIK, PostScript::Simple doesn't provide any support for this...