[gs-bugs] [Bug 690245] Embed JPG image into PDF

bugs.ghostscript.com-bugzilla-daemon at ghostscript.com bugs.ghostscript.com-bugzilla-daemon at ghostscript.com
Wed Jan 21 06:09:19 PST 2009


http://bugs.ghostscript.com/show_bug.cgi?id=690245





------- Additional Comments From ken.sharp at artifex.com  2009-01-21 06:09 -------
Created an attachment (id=4745)
 --> (http://bugs.ghostscript.com/attachment.cgi?id=4745&action=view)
read_jpeg.ps

Do you mean create a brand new PDF file which only contains the JPEG image, or
add a JPEG image to an existing PDF file ?

You can do the former with pdfwrite, though there is no direct way that I'm
aware of to open a JPEG file in GS. You first need to convert it into
PostScript. One way is to open it in an image viewer and print to a PostScript
file. Another is simply to write some basic PostScript. Both the PDF and
PostScript specification suppport the DCTDecode filter which will read JPEG
files.

Having said that, its almost as easy to convert a JPEG file straight into a PDF
file for the same reason. 

There are a number of free tools which will convert JPEG (and often other file
formats) into PDF, a quicjk Google finds (for example):
http://www.jpegtopdf.com/

I've attached a PostScript file which renders a JPEG file. By selecting the
pdfwrite device you can get a PDF file instead of rendering. 

This file is pretty crude, you need to supply the filename and image dimensions
at the top of the file. It could be improved by reading the dimensions from the
JPEG header. It could also be converted to read the FileName from an existing
dictionary, so that you could supply the filename by sending PostScirpt on the
command line.



------- You are receiving this mail because: -------
You are the QA contact for the bug, or are watching the QA contact.



More information about the gs-bugs mailing list