• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PostScript left margin assistance requested

New Here ,
Jan 02, 2015 Jan 02, 2015

Copy link to clipboard

Copied

Happy New Year!

On a Mac OS X system, in the Terminal application, I can do, for example:

man -t mdls | open -f -a Preview

And the "man page" for the "mdls" command is opened in Preview, rather than displayed on the Terminal screen.

The problem is that the font is a little too small, and I want to make it bigger. The "-t" option of the "man" command says to produce PostScript, which Preview understands how to display, so I reasoned that I could do:

man -t mdls >mdls.ps

I then examined the resulting PostScript file and found many occurrences of things like "10/Times-Roman" and "10/Times-Bold". So I did a global search/replace and changed all "10/Times" to "12/Times". This worked fine, and the page is now more readable within Preview. Of course, manually editing a PS file every time is tedious, so I changed my original task to:

man -t mdls | sed 's/10\/Times/12\/Times/g' | open -f -a Preview

This works fine, too. The only problem -- and here's the real purpose of my question today -- is that the larger font causes some of the text to run off the right edge of the displayed page (it's apparently truncated). Stretching the Preview window wider does not help. But I notice that there's a fairly wide left margin. If I could figure out how to reduce the left margin, then my text should display just fine. OR... if I could figure out how to re-wrap the text, then it should also display fine.

So these are my questions:

1) Is it possible, given an existing PostScript file, to re-wrap the text so that it doesn't get truncated along the right edge of the page? If not, then...

2) How can I reduce the size of the left margin in the PS file to make more room for the larger text?

If it would help to see an example of the PostScript produced by the OSX "man" command, let me know... I'd be happy to show you.

Thanks!

B.

TOPICS
Programming

Views

830

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Jan 02, 2015 Jan 02, 2015

In principal, this should be relatively simple; just issue a call to the translate operator at the top of each page, something like

     -12 0 translate

In practice, the appropriate place in the code to insert this line depends on how the PostScript program is written; in particular, you want to do this after the PS's own initialization code but before the commands that draw the text. If it's convenient for you to send me the man page's PS code (my email address is below), I can suggest precisely

...

Votes

Translate

Translate
Jan 02, 2015 Jan 02, 2015

Copy link to clipboard

Copied

Line layout is done by the man program. You can't do simple edits to either PostScript (or PDF) to accomplish what you want. Depending upon how the PostScript was generated, conceivably you could replace the horizontal location (typically in points) at which the text starts with a lower value. But very often, PostScript is written using user-defined procedures which disguise what you actually see in the PostScript file as commands and would make such editing difficult.

     - Dov

- Dov Isaacs, former Adobe Principal Scientist (April 30, 1990 - May 30, 2021)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 02, 2015 Jan 02, 2015

Copy link to clipboard

Copied

Dov Isaacs: PostScript is a programming language...different in many ways from other languages, but a language nonetheless. Each PostScript file is human-readable (albeit perhaps difficult to read) text, and as such, can be edited. I found that I can, in fact, do simple edits to PostScript, contrary to your assertion otherwise. I was able to increase the font size without any trouble. And with John's assistance (see his correct answer above), was also able to fix my left margins.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Jan 02, 2015 Jan 02, 2015

Copy link to clipboard

Copied

LATEST

I did not say that it could not be edited, but rather, depending upon how the PostScript stream was generated, could be very difficult. Not all PostScript generated by drivers is very straightforward. It is often several layers deep in user-defined procedures with no comments or reasonably named procedures or variables. That's why we don't recommend editing of PostScript files in general.

That having been said, I am glad you found a simple solution for your particular situation. Most are not simple to resolve. (I have over 25 years experience dealing with this stuff and it is not fun!)

          - Dov

- Dov Isaacs, former Adobe Principal Scientist (April 30, 1990 - May 30, 2021)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jan 02, 2015 Jan 02, 2015

Copy link to clipboard

Copied

In principal, this should be relatively simple; just issue a call to the translate operator at the top of each page, something like

     -12 0 translate

In practice, the appropriate place in the code to insert this line depends on how the PostScript program is written; in particular, you want to do this after the PS's own initialization code but before the commands that draw the text. If it's convenient for you to send me the man page's PS code (my email address is below), I can suggest precisely where to insert the translate call.

- John Deubert

----

John Deubert                                        Acumen Training

john@acumentraining.com      PostScript & PDF training & consulting

+1-949-248-1241                       http://www.acumentraining.com

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines