Is there a virtual printer to output an Open Office doc to multiple images (jpg, png etc)?
I'm after a virtual printer which takes each page of "printed" output and converts into multiple images (one image for each page)... eg. .jpg, or .png, etc..
I'm specifically looking for something to work with Open-Office Writer, but I assume that such a virtual printer would work across the board for any app which can send its output to a "printer".
Is there such a thing in the Ubuntu repository?
PS. I want one "normal" picture image per page.. ie Many images are output.
...(like the Snagit virtual printer in Windows)
Does it need to be an image file rather than a PDF? If not, you could use
sudo apt-get install cups-pdf
With ImageMagick you can convert PDFs to images from the command line but maybe that's getting too longwinded. Also, though I don't have it installed on the machine I'm currently used, I read on blog comment that GIMP can open PDFs...?
First print your document as pdf and then you can convert it to jpg or png using GIMP.
Printing your document as pdf:
Open your document in open office,and then click pdf option to export your document as pdf or goto file menu and choose export as pdf.
Converting pdf to jpg|png:
Open your pdf in GIMP(Right click your pdf and then choose Open with GIMP Image Editor)
Now again goto file menu and select the option save as,Now be sure you choose the correct format.Choose JPG or PNG to save that pdf file into image format..
Well, i finally found a way to get it to produce individually numbered jpegs; one per page of printed output.
--(also, see the UPDATE, below)--
First, I added a "Generic-PostScript-Printer"..Panel -> Sysetm -> Administration -> Printing
or$ system-config-printer
The next step is, in OpenOffice, to choose [*] Print to file
(in the Print dialog)
and save the PostScrip file to wherever you like, eg. ~/print-to-file.ps
The final step is to use ghostscript
to do the conversion. It has many output devices.
You can list the devices via: $ gs -h
To output sequentiall numbered jpeg images, this is the command:
$ gs -dBATCH -dNOPAUSE \
-sOutputFile=/home/fred/print-to-file.ps.%d.jpeg \
-sDEVICE=jpeg /home/fred.print-to-file.ps`
For the png format, change the filename's sufix to .png.
and use png16 / png256 / etc for -sDEVICE
UPDATE:
I've just now realized that ghostscript can also take a .pdf as input...
So I tried using the .pdf from OpenOffice's Export to PDF option, as the input to gs
(ghostscript) ...
The .odt source file was text-only and the resluting images have marginally better kearning, so it may be worth comparing the ".pdf" as imput, vs ".ps" for your specific situation.. font, images etc...
In summary (for this pdf method):
- Export as PDF
-
$ gs -dBATCH -dNOPAUSE -sOutputFile=/home/fred/print-to-file.pdf.%d.jpeg -sDEVICE=jpeg /home/fred.print-to-file.pdf
UPDATE 2:
Although this method works, the quality of output images was not up to par.
Upping the jpg quality to 100% still produced sub-standard results..
Even tiff images were producing aberrations in the text (no anti-aliasing?).
Maybe there is a way to tweak ghostscript further, but I started looking elsewhere, and thanks to Roddie's suggestion, I've changed my tack and definitely prefer the "non virtual-printer" method of unoconv
+ ImageMagick
(mentioned in my comment to Roddie's answer)... The image quality from ImageMagick is great! ..
A "two line" script of these two commands would make a simple "Nautilus Action", and bypass the need to directly use OpenOffice.
But if you want to convert an unsaved document to images, then you would need you use "cups-pdf" or the menu "File->Save as PDF" option instead of "unoconv".
Its not something ive ever needed to do on linux but cups-pdf
looks like it might do the job for you. This is available in the software centre or via the terminal:
sudo apt-get install cups-pdf
you can check if everything has worked by going to System > Administration > Printing, and you should have a printer there called pdf. As its installed as a printer on the system, it should work with any application that would normally print.
By default these are saved to a folder called PDF under your home folder. It is possible to change this by altering /etc/cups/cups-pdf.conf
. Search for the OUT variable and change this to whatever you want.
Im not sure there is anyway to alter the save location on a per-usage basis, perhaps someone with more knowledge would be able to elaborate.
As a side note, Open Office writer already has an option to export to pdf in the file menu.
We have taken the sources of cups-pdf and modified them to create svg.
This way we have a virtual network printer that creates svg for all our MS windows users.
As explained above the advantage for Linux users is smaller as they can always output ps or pdf and use inkscape or so to create svg.
However, even for Linux users it can be convenient to 'just print' and pick up the resulting svg in the user directory of the server.
Limitation we have now is that only 1 page (1 svg file) can be output at a time.
I am looking for somebody interested to package the code and place it on an ubuntu ppa.
You can mail me at ftoth AT telfort.nl
Ferry