user3991484
user3991484

Reputation: 93

Adding a jpeg image to a post script file

I am trying to read in a jpeg file with java and write it to my post script file. When I open the post script file with the Acrobat distiller I get an error:

%%[ Error: typecheck; OffendingCommand: imageDistiller ]%%

Stack:
{(   Leaving filterIntercept
) --print-- --flush--}
false
/DCTDecode
-dict-
-file-


%%[ Flushing: rest of job (to end-of-file) will be ignored ]%%
%%[ Warning: PostScript error. No PDF file produced. ] %%

The following is what my postscript file looks like minus the jpeg data.

%!PS-Adobe-3.0

/jpegimage
{173 36 1 [173 0 0 -36 0 36]
{currentfile /ASCII85Decode filter /DCTDecode filter}
image
} bind def

%%Page: 1 1
%%PageBoundingBox: 0 0 612.0 792.0

100 200 translate
jpegimage
...(jpeg data inline here)...
showpage
%%PageTrailer

%%Trailer
%%EOF

Upvotes: 2

Views: 222

Answers (1)

luser droog
luser droog

Reputation: 19484

I think the problem is using the proc form of the image call. In this form, the proc must yield a string, not a file.

Try adding 256 string readstring pop at the end of the proc.

I think you may need to read and discard the jpeg header before the DCT filter gets to the DCT-encoded data.

In the dictionary form image will accept a file as a source.

Upvotes: 1

Related Questions