Re: reading postscript file
Re: reading postscript file
- Subject: Re: reading postscript file
- From: Tomas Zahradnicky <email@hidden>
- Date: Wed, 28 Jan 2004 20:28:36 +0100
Dear All,
I tried to read a postscript file and display it in an NSImageView in Panther.
However, it seems that Cocoa interprets my PS file as an A4 size (or
Letter size. i don't know) image when I do something like:
bcImage = [[NSImage alloc] initWithContentsOfFile:@"test.ps"];
The whole page is white and my image appears at the button left
corner of the page.
How can I tell Cocoa/Core Graphics to crop the white space
automatically? Or is there any way to ask tell Cocoa not to treat my
image as a page?
Attached is the raw postscript file.
Thank you very much for your help.
Yours,
Bill
Hi Bill,
I'm not sure whether I can help you but the postscript file is
entirely missing the
%%BoundingBox: 0 0 width height
comment. The postscript also does not specify the page size or
anything else that could help to understand the width and height of
the image. That implies default page size is used and it may be A4 or
US letter.
Seems you're the one who generated the postscript and therefore try
to add %%BoundingBox comment and see if it helps or not.
-Tomas
%!PS-Adobe-2.0
%%Creator: libbarcode
%%EndComments
% Printing barcode for "HEADNIX", scaled 1.00, encoded using "code 93"
% The space/bar succession is represented by the following widths
(space first):
% 01111411122122212112111132211121113211123111122211321112122111111411
[
% height xpos ypos width height xpos ypos width
[70.00 10.50 20.00 0.85] [70.00 12.50 20.00 0.85]
[70.00 16.00 20.00 3.85] [70.00 19.50 20.00 0.85]
[70.00 22.00 20.00 1.85] [70.00 25.50 20.00 0.85]
[70.00 29.00 20.00 1.85] [70.00 32.50 20.00 0.85]
[70.00 35.50 20.00 0.85] [70.00 38.00 20.00 1.85]
[70.00 40.50 20.00 0.85] [70.00 42.50 20.00 0.85]
[70.00 47.00 20.00 1.85] [70.00 50.50 20.00 0.85]
[70.00 52.50 20.00 0.85] [70.00 55.50 20.00 0.85]
[70.00 57.50 20.00 0.85] [70.00 62.00 20.00 1.85]
[70.00 64.50 20.00 0.85] [70.00 67.00 20.00 1.85]
[70.00 71.50 20.00 0.85] [70.00 73.50 20.00 0.85]
[70.00 76.00 20.00 1.85] [70.00 80.00 20.00 1.85]
[70.00 82.50 20.00 0.85] [70.00 87.00 20.00 1.85]
[70.00 89.50 20.00 0.85] [70.00 92.00 20.00 1.85]
[70.00 95.00 20.00 1.85] [70.00 98.50 20.00 0.85]
[70.00 100.50 20.00 0.85] [70.00 102.50 20.00 0.85]
[70.00 106.00 20.00 3.85] [70.00 109.50 20.00 0.85]
] { {} forall setlinewidth moveto 0 exch rlineto stroke} bind forall
[
% char xpos ypos fontsize
[(H) 32.00 10.00 12.00]
[(E) 41.00 10.00 0.00]
[(A) 50.00 10.00 0.00]
[(D) 59.00 10.00 0.00]
[(N) 68.00 10.00 0.00]
[(I) 77.00 10.00 0.00]
[(X) 86.00 10.00 0.00]
] { {} forall dup 0.00 ne {
/Helvetica findfont exch scalefont setfont
} {pop} ifelse
moveto show} bind forall
% End barcode for "HEADNIX"
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
--
Ing. Tomas Zahradnicky, Jr.
Production Manager, 24U Software
Associate Member, Filemaker Solutions Alliance
mailto:email@hidden
http://www.24uSoftware.com
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.