[Date Prev][Date Next][Thread Prev][Thread Next]
[Author Index]
[Date Index]
[Thread Index]
[SQR-USERS Info]
[SQRUG Home Page]
Re: More fun with postscript
Matthew,
I've been going through similar pain, although my task was to print a
quite complex form (actually a bill for a telco). I had two main
problems : position things accurately on the page, and right
justification. My solution was as follows :
* Define character width and line height to 1 (point).
This give me adequate precision for positioning text
* Set all margins to 0. Using postscript this really
works. You can actually print to the edge of the page
* Create my own print (and box/line) routines taking x,y
co-ords in mm, and converting them to points
* Wrote a C function to calculate the width in mm of a
given string - to allow for right justification.
If any of this sounds as though it may be useful, e-mail me and I'll
send you the code. By the way, I haven't bothered with spf files - I
use GhostView to directly view the postscript files created by SQR.
It's a much more WYSIWYG than the spf viewer for postscript. You can
get GhostView (etc) at :
http://www.cs.wisc.edu/~ghost/aladdin/index.html
Regards
Steve
----------------------------------------------
Steve Baldwin
Phone : +61 3 9840 3829
Fax : +61 3 9840 3824
E-Mail : Steven.Baldwin@hancorp.com.au
----------------------------------------------
> ----------
> From: Matthew Estela[SMTP:matthewe@CORDELL.COM.AU]
> Sent: Thursday, 20 November 1997 11:10
> To: Multiple recipients of list SQR-USERS
> Subject: More fun with postscript
>
> Can anyone explain this one to me?
>
> I've been wrestling with .spf output for aaaages trying to get the
> margins exactly where I want, when I eventually found out that certian
> sqr 'features' prevent me from getting as close to the page edges as
> the
> printer will allow.
>
> Anyway, after a bit of fiddling I managed to get postscript output
> happening, and I've got the margins where I want. Almost.
>
> For some reason the first page has about 4mm chopped off the top
> margin,
> but each page after that is fine. I blamed the printer at first (a
> laserjet 4si MX), but when I tried with another printer (a QMS), it
> had
> the same problem.
>
> I know what you're thinking, use 'new-page' before I start printing
> data, right? Nope, seems there's some extra funky stuff going on, the
> page after the break still has the chopped top. I even tried
> displaying
> some text before using new-page, but I still got the same error.
>
> In a fit of inspiration I looked at the ps source to see if there was
> any difference in the code behind breaking the between using new-page
> and the break as handled by sqr, and would you believe it, there is
> none.
>
> The test program I'm using is small, so here it is. Run it, have it
> work
> properly, tell me, and make me feel really bad. I've hardcoded the
> lines
> because using a bottom margin didn't work, but that's another story.
> The
> reason the margins/lines etc is so important is because I'm printing
> to
> A4 sheets of mailing labels, and it's nothing short of a nightmare
> setting this up.
>
> BEGIN-SETUP
> declare-layout default
> paper-size=(A4)
> left-margin=5mm
> top-margin = 10mm
> max-lines = 67
> line-height = 12
> char-width = 6.1
> end-declare
> END-SETUP
>
> BEGIN-PROGRAM
> use-printer-type ps
> DO Main
>
> END-PROGRAM
>
> BEGIN-PROCEDURE Main
> alter-printer font=5 point-size=10
> print 'test page' (1,1)
> new-page
> let #i = 1
> print #i (1,1)
> add 1 to #i
> while #i < 100
> print #i (+1,1)
> add 1 to #i
> end-while
> END-PROCEDURE
>
>
> Vital stats:
> SQRv4.03 for Oracle on win95
> PrintFile v2.0 so I can dump ps files to the printer from the desktop
> Sagittarius
> Turn offs are smoking, ancho- oh wait, too much information...
>
> Thanks all.
>
> Matt
>