Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP: Inserting images into PS-document

Status
Not open for further replies.

Petri

Programmer
Jul 31, 2000
6
SE
<br>Hi,<br><br>I wonder if there is somebody who can help me<br>import/link a image in a PS-document.<br>Is there a easy way to do this?<br><br>Thank you in advance,<br>Petri<br>
 
First of all what kind of image do you want to import in PS-Document???
 
The image command and the image dictionary exist to put bitmap images into PS documents.&nbsp;&nbsp;Below is a small JPEG image (hence the DCTdecode filter) embedded into a PS file for an example.&nbsp;&nbsp;I've noticed a few of your questions here, and most of them are readily answered in the PS big red book.&nbsp;&nbsp;If you need a friendlier introduction to Postscript, try using Glenn Reid's 'Thinking in Postscript', available for download at <A HREF=" TARGET="_new"> that, the big red book (and the little green and blue ones), and the user groups can help you get by.&nbsp;&nbsp;In fact, the blue book has sample code which answers one of your other questions - how to do a word-splitting algorithm - I've added it at the end of this answer<br><br><br><br>0.00 rotate<br>0.00 0.00 translate<br>/infile currentfile<br>/ASCII85Decode filter<br>/DCTDecode filter def<br>/DeviceRGB setcolorspace<br>87.00 510.00 translate<br>72.00 dup 298 96.00 div mul exch 398 96.00 div mul scale<br>&lt;&lt; /ImageType 1<br>&nbsp;&nbsp;&nbsp;/Width&nbsp;&nbsp;298<br>&nbsp;&nbsp;&nbsp;/Height 398<br>&nbsp;&nbsp;&nbsp;/BitsPerComponent 8<br>&nbsp;&nbsp;&nbsp;/ImageMatrix [298 0 0 398 0 0]<br>&nbsp;&nbsp;&nbsp;/Interpolate false<br>&nbsp;&nbsp;&nbsp;/Decode [0 1 0 1 0 1]<br>&nbsp;&nbsp;&nbsp;/DataSource infile&gt;&gt;<br>image<br>s4IA0!... lots of data goes here...unfortunately, double quotes confuse Tek-Tips editor, and there are double quotes in the data stream - I can email you the sample if you send me an address here.<br>...OhGA$s/~&gt;<br><br>Now, the word-splitting example<br><br><br>%%Title: Blue Book Program 12, on page 179<br>%%Creator: Adobe Systems Incorporated <br>%%CreationDate: Thu Dec 28 17:56:06 PST 1989<br>%%EndComments<br><br>/wordbreak ( ) def<br>/BreakIntoLines<br>&nbsp;&nbsp;{ /proc exch def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/linelength exch def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/textstring exch def<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/breakwidth wordbreak stringwidth pop def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/curwidth 0 def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/lastwordbreak 0 def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/startchar 0 def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/restoftext textstring def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ restoftext wordbreak search<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ /nextword exch def pop<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/restoftext exch def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/wordwidth nextword stringwidth pop def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;curwidth wordwidth add linelength gt<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ textstring startchar<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;lastwordbreak startchar sub<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getinterval proc<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/startchar lastwordbreak def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/curwidth wordwidth breakwidth add def }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{ /curwidth curwidth wordwidth add<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;breakwidth add def <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} ifelse<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/lastwordbreak lastwordbreak<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;nextword length add 1 add def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{pop exit}<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ifelse<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;} loop<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/lastchar textstring length def<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;textstring startchar lastchar startchar sub <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;getinterval proc<br>&nbsp;&nbsp;} def<br><br>/Times-Roman findfont 16 scalefont setfont<br>/yline 650 def<br><br>(In every period there have been better or worse\<br>&nbsp;types employed in better or worse ways. The\<br>&nbsp;better types employed in better ways have been\<br>&nbsp;used by the educated printer acquainted with\<br>&nbsp;standards and history, directed by taste and\<br>&nbsp;a sense of the fitness of things, and facing the\<br>&nbsp;industrial conditions and the needs of his time.\<br>&nbsp;Such men have made of printing an art. The\<br>&nbsp;poorer types and methods have been employed\<br>&nbsp;by printers ignorant of standards and caring\<br>&nbsp;alone for commercial success. To these, printing\<br>&nbsp;has been simply a trade. The typography of a\<br>&nbsp;nation has been good or bad as one or other of\<br>&nbsp;these classes had the supremacy. And to-day\<br>&nbsp;any intelligent printer can educate his taste, so\<br>&nbsp;to choose types for his work and so to use them,\<br>&nbsp;that he will help printing to be an art rather\<br>&nbsp;than a trade. \261Daniel Berkeley Updike.)<br>&nbsp;<br>&nbsp;&nbsp;300<br>&nbsp;&nbsp;{ 72 yline moveto dup stringwidth pop linelength exch sub 1 index length div dup 2 lt { 0 3 2 roll ashow } { pop show } ifelse<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;/yline yline 18 sub def }<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>BreakIntoLines<br><br>% EXERCISE FOR THE READER:&nbsp;&nbsp;If the user specifies a short<br>% enough line length, it is possible for the typeset width <br>% of a single word to exceed the maximum line length.&nbsp;&nbsp;<br>% Modify this algorithm to handle this event gracefully.<br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top