shairontoledo / rghost

RGhost is a document creation and conversion API. It uses the Ghostscript framework for the format conversion, utilizes EPS templates and is optimized to work with larger documents. Support(PDF,PS,GIF,TIF,PNG,JPG,etc)
http://rghost.rubyforge.org
MIT License
187 stars 46 forks source link

How to render a PNG in the PDF #59

Closed ernest-ns closed 9 years ago

ernest-ns commented 10 years ago

I want to include a PNG in a PDF file that I generate using RGhost. I saw that the documentation of RGhost indicated it has PNG support, but could not find a class that I could use for the same (like RGhost::Jpeg for JPEGs).

I tried the following code to render a PDF containing a PNG file, but the resultant document was blank:

doc = RGhost::Document.new
doc.set RGhost::Image.new(png_file_path)
doc.render :pdf, :filename => pdf_file_path

When I went through the source code, I saw lines such as the following in the comment sections, but could not figure out how to use it to render PNGs in PDFs:

#link:images/sample_image.png

Is there anything I'm missing here that I should be doing?

Thanks in advance.

shairontoledo commented 10 years ago

@ernest-ns If you found that comment then it's a typo, there is no support in RGhost to render input image as PNG, only output is supported.