Skip to content

Avoid temp PS file in psconvert #1435

@joa-quim

Description

@joa-quim

Thai massages are even better (and last longer) then morning showers, also in terms of inspiration.

But to the point. It always tickled me that we have to make an entire copy of the to-be-converted PS file that has only very small modifications. On the other hand, in a current ongoing thread of gs-devel mail list Chris said

‘An EPS file shouldn't call setpagedevice’

But that’s what we actually do when written EPS files. Don’t remember anymore why we do it, but maybe we don’t need it.

For simple raster conversions where only -A matters all turns out to update the BB to the right values, but it’s here that we shouldn’t need to create a temporary file only for that. Imagine that we start writing an extra comment line after the BB and HighRes BB that has something like

%%%ighRes BoundingBox: 0 0 0000000000000000 0000000000000

Then, with fseek we could replace the above line with the correct BB info and also comment the two precedent lines (that have the estimated BB by GMT) just by replacing the third char by a %. And that’s it (well, almost), this file is ready to be feed to gs to do the transform. And more, we can easily undo these changes after the gs job is done. The “almost” is because if we also have to deal with the Portrait vs Landscape rotation case then there probably something else to be taken care. But the same logic could be applied.

Metadata

Metadata

Assignees

No one assigned

    Labels

    longtermLong standing issues that need to be resolved

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions