LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Rotating a pdf file with convert loses resolution (https://www.linuxquestions.org/questions/linux-software-2/rotating-a-pdf-file-with-convert-loses-resolution-795854/)

Geriao 03-16-2010 03:22 PM

Rotating a pdf file with convert loses resolution
 
I'm trying to rotate a whole pdf file 180 degrees using

Code:

convert original.pdf -rotate 180 final.pdf
But the resolution of final.pdf is quite bad, not like original.pdf's.

Is there a way to mantain the original resolution, or another tool that can do that? I use Slackware 13.0.

Thanks in advance!!

H_TeXMeX_H 03-16-2010 04:46 PM

Try using:
http://www.accesspdf.com/pdftk/

smoker 03-16-2010 04:50 PM

Use mogrify instead ?

Geriao 03-16-2010 07:14 PM

I tried to compile pdftk, but I got this error, after lots of warnings:

Code:

gcjh --classpath="." Gnu;
Exception in thread "main" java.io.IOException: can't find class file
java_local/security/Provider.class in
java.net.URLClassLoader{urls=[file:/home/thales/downloads/builds/pdftk/pdftk-1.41/java_libs/gnu_local/java/security/provider/./,file:/usr/share/java/libgcj-4.3.3.jar],
parent=gnu.gcj.runtime.SystemClassLoader{urls=[file:./],
parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}}
  at gnu.classpath.tools.javah.Main.getClass(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.ClassWrapper.linkSupers(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.ClassWrapper.printFully(libgcj-tools.so.9)
  at
gnu.classpath.tools.javah.CniIncludePrinter.printClass(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.Main.writeHeaders(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.Main.run(libgcj-tools.so.9)
  at gnu.classpath.tools.javah.GcjhMain.main(libgcj-tools.so.9)
make[2]: *** [Gnu.h] Error 1
rm Gnu.class
make[2]: Leaving directory
`/home/thales/downloads/builds/pdftk/pdftk-1.41/java_libs/gnu_local/java/security/provider'
make[1]: *** [libgcj_local] Error 2
make[1]: Leaving directory
`/home/thales/downloads/builds

I couldn't figure out how to fix this. I use gcc/gcj 4.3.3, so I guess it would work fine.


And as I said I tried convert/mogify, but the resolution of the output is crappy...

Is there a way to make the resolution better? It would just fine to use convert...

smoker 03-16-2010 10:49 PM

You didn't say you'd tried mogrify, and convert actually is designed to "convert" from one format to another. If you can find an option to preserve the resolution for convert then good luck. Maybe you would be better off converting the file to images then rotating each image, before making a pdf out of them.

Geriao 03-17-2010 09:44 AM

Actually mogrify is the same as convert. From mogrify's man page:

Quote:

Mogrify overwrites the original
image file, whereas, convert(1) writes to a different image file.
Maybe converting to images would be fine... If convert can indeed mantain the resolution... I still have to figure out if there's such an option (it should!).

H_TeXMeX_H 03-17-2010 12:24 PM

Hmm, yeah, it looks like nobody's maintaining it anymore.

Well, here are some alternatives:
http://sourceforge.net/projects/jpdftweak/files/
http://sourceforge.net/projects/pdfshuffler/files/

I tested the first one and it works. The second one has some dependencies.

Geriao 03-17-2010 03:43 PM

I think you are right. I emailed the author of pdftk about this compile error a couple days ago, and didn't get an answer... That, and the gcc he recommends is version 3.5.2.

Anyway, I got convert to work properly... The correct option to use in convert/mogrify is '-density XXX'. The default is 72 (dpi), so all pdfs look like crap. I used:

convert -density 200 original.pdf -rotate 180 final.pdf

and it worked fine. Thanks everyone.


All times are GMT -5. The time now is 06:33 AM.