i have a problem with ghostscript, Times New Roman and pdf.
My System:
OS: Mac 10.11.6
Ghostscript: 9.21
I want to scale my pdf with following code in terminal:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dDownsampleColorImages=true \ -dColorImageResolution=150 -dNOPAUSE -dBATCH -sOutputFile=output.pdf input.pdf
Now i have problems with the font Times New Roman.
In the Output.pdf the textline "Unabhängige Heimatzeitung" is broken, if you open the pdf in Safari or in Mac Quick View.
Here is the Link to the input.pdf
input.pdf
Here is the Link to the putput.pdf
output.pdf
Can anyone help me?
Many thanks in advance!
It does seem that there is some problem with the PDF. Acrobat preflight reports syntax errors.
You might try a different method: produce PostScript of the PDF, then run that through GS.
Or create (or download) Quartz Filters for OS X using ColorSync Utility to reduce the size of the PDF, and apply the filter to the original PDF.
Related
Trying to play with ImageMagick to read scanned PDF texts, but at the point to convert the PDF to image, I've got this error, where it shows "no decode delegate for this image format `PDF' # error/constitute.c/ReadImage/504". Been search for this solution for hours to no avail, need some help here.
OS: Windows 7 x64
ImageMagick Version: ImageMagick-6.9.8-10-Q16-x86-dll.exe
convert -list format
shows below output
Format Module Mode Description
-------------------------------------------
* native blob support
r read support
w write support
+ support for multiple images
Looks like your delegates are not properly configured,
Once Ghostscript is installed make sure the binary folder C:\Program Files/gs/gs3.0.9/bin is added to your path.
Once Done, there should be a file names delegates.mgk in you graphics magick home directory. Open that file in a text editor.
<delegate decode="pdf" encode="eps" mode="bi" command='"#PSDelegate#" -q -dBATCH -dSAFER -dMaxBitmap=50000000 -dNOPAUSE -sDEVICE=#GSEPSDevice# "-sOutputFile=%o" -- "%i" -c quit' />
In the whole file, find and replace #PSDelegate# with gswin64c and it should get the job done.
I have a PDF file that I need to change the orientation from landscape to portrait, using this command GS. The Orientation switch it is not changing the orientation. Is there a extra setting I need to add?
::Path to your Ghostscript EXE
set GSC="C:\Program Files (x86)\gs\gs9.16\bin\gswin32.exe"
%GSC% -sDEVICE=pdfwrite -sOutputFile="D:\TRANS\PDF\2_ZNOR_00000000000000000070.pdf" -dNOPAUSE -dEPSCrop -c "<</Orientation 3>> setpagedevice" -f "D:\TRANS\PDF\1_ZNOR_00000000000000000070.pdf"
It worked for me
List<string> switches = new List<string>
{
"-empty",
"-dQUIET",
"-dSAFER",
"-dBATCH",
"-dNOPAUSE",
"-dNOPROMPT",
"-dDEVICEHEIGHTPOINTS=612",
"-dDEVICEWIDTHPOINTS=792",
"-dFIXEDMEDIA",
"-dFitPage",
"-sDEVICE=pdfwrite",
"-dAutoRotatePages=/None",
"-sOutputFile=" + resultFilePath,
"-c",
"<</Orientation 1>> setpagedevice",
"-f"
};
switches.Add(this.FilePath);
Most of the switches you are using there will have no effect at all, and you haven't done anything to rotate the PDF file either.
The first thing to note is that Ghostscript is really the wrong tool for this job, it doesn't modify PDF files, it generates completely new ones. The process is described here
The -dEPSCrop switch only has an effect if the input is an EPS file, otherwise it does nothing.
The operands to setpagedevice are incorrect, you are passing an empty hex string <> when setpagedevice expects a dictionary <<>>. Even then an empty dictionary will do nothing.
I expect you intended to put <</Orientation 1>> setpagedevice but actually that's only a media matching request. In order to get Ghostscript to create a rotated PDF file you would have to alter the media size, set it to fixed, and set -dFitPage. You would also have to set the AutoRotatePages switch to None in order to prevent the automatic reorientation of the output so that the text is horizontal.
Since you haven't supplied the PDF file to look at, nor stated its media size, I can only guess at the sizes. However, something like
gswin32c.exe -sDEVICE=pdfwrite -sOutputFile=new.pdf -dDEVICEHEIGHTPOINTS=612 -dDEVICEWIDTHPOINTS=792 -dFitPage -dAutoRotatePages=/None input.pdf
For some documents that I need to convert into images (jpeg) through the (templated) command gs -dNOPAUSE -sDEVICE=jpeg -dBATCH -r133 -sOutputFile=/my/path/%d.jpg file, sometimes I get the following error :
./base/gdevp14.c:3632: pdf14_update_device_color_procs_push_c(): Missing ICC data
the process then launches a signal 11 (which is a segfault I believe). I'm using Ghostscript 9.05 on the machines where this crashes, but on another machine equipped with Ghostscript 9.10, it runs just fine, for (exactly) the same document.
I thought that I could be missing something, but what could it be ?
thanks !
Update to something a little more recent. The current version is 9.16. If you continue to experience problems then file a bug report. I would guess that your bug has been fixed somewhere between 9.05 and 9.10.....
By overriding the ICC settings, it seems that it is doing fine : gs -dNOPAUSE -sDEVICE=jpeg -dOverrideICC -dBATCH -r133 -sOutputFile=/my/path/%d.jpg file.
A PDF that was failing, once exported to a new PDF worked just fine, so I guess there was something amiss in the original PDF, that ghostscript didn't like very much. Overriding the ICC settings with the default ones on the current machine seems to do the trick.
I m converting a pdf into image using ghostscript
It almost produces good images but for one pdf the created image is having a white strip
however this strip is not present in the original pdf.
script which i hv used is below
gs -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=2 -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=fileName.gif -dJPEGQ=100 -r300 -q pdfName.pdf -c quit
Here the created image http://www.pictureshack.us/images/65486_1.gif
i am using Ghostscript 8.70 and the issue is fixed for the latest update i.e 9.06, but i cant upgrade to this...moreover found the issue its due -r300, so when i specify resolution of 100 then it works fine for this pdf but not for many other pdf...
You don't say what version of Ghostscript you are using, and you haven't provided the original PDF file, so I can't test it on current code. However, this 'looks like' a transparency bug, and may well be fixed in recent versions of Ghostscript.
I would suggest you upgrade to 9.06 if you haven't already and try that. If the problem persists please open a bug report at http://bugs.ghostscript.com Please attach the original PDF file and the command line you are using.
Is it possible to export odp / ppt slides as images using unoconv?
For example,
unoconv -f png presentation.ppt
But this unoconv command converts only the first slide as a png file. Is it possible to export all slides as individual images, say, 001.png, 002.png, 003.png using unoconv on the command line?
If not, could you suggest a simple bash script to go over slide by slide in the odp / ppt file to convert to images?
Thanks.
One way to do this is to first convert it to PDF, and then use Ghostscript to convert to PNG files. The following works for me:
unoconv -f pdf presentation.ppt
gs -sOutputFile=presentation-%03d.png -dNOPAUSE -dSAFER -sDEVICE=png16m \
-dBATCH -q -r300 -dGraphicsAlphaBits=4 -dTextAlphaBits=4 presentation.pdf
(The -r300 parameter says to create 300 pixels-per-inch PNG files - you may want to adjust that.)
You can covert the PPT file to HTML:
unoconv -o image/ -f html SinoProbe_02_02_001.ppt
Then the image folder will fill with HTML and JPG files.
I just tested the Export as Images extension for Open Office v4.1.1 on Windows 7. Worked GREAT. I had more control over the graphics size etc than when exporting to HTML and using the included files.
http://extensions.services.openoffice.org/en/project/export-images