Mostrando entradas con la etiqueta pdf. Mostrar todas las entradas
Mostrando entradas con la etiqueta pdf. Mostrar todas las entradas

2023-02-24

Merge two pdfs in the same page in GNU/Linux (Debian/Ubuntu)

If you have two pdfs and you want to print them in a single page, you can start by merging both in a single page in a 3rd pdf.

Maybe you need to install using the following:

sudo apt install texlive-extra-utils

Then you can merge using one of the following commands:

  • Vertical
    pdfjam *.pdf --nup 1x2 --outfile merged.pdf
  • Horizontal
    pdfjam *.pdf --nup 2x1 --outfile merged.pdf
  • Landscape
    pdfjam *.pdf --nup 2x1 --landscape --outfile merged.pdf

Happy hacking!!!

2018-05-11

Cómo reducir el tamaño de archivos PDF en GNU/Linux

Para reducir el tamaño de archivos PDF en GNU/Linux, necesitaremos tener instalado GhostScript para lo cual podemos ejecutar el comando:

sudo aptitude install ghostscript

Con GhostScript instalado ya se puede comprimir con el situiente comando:

gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -sOutputFile=pdf-reducido.pdf pdf-original.pdf

Donde -dPDFSETTINGS=/ebook nos indica la calidad del PDF reducido y cuyos posibles valores para /ebook son:

  • /screen (72 dpi, baja calidad y destinado a ver por pantalla)
  • /ebook (150 dpi, calidad media y destinado a leer como ebook)
  • /printer (300 dpi, alta calidad y destinado a imprimirse)
  • /prepress (300 dpi, alta calidad preservando el color y destinado a imprimirse)
  • /default (viene a ser lo mismo /screen)

Además existe un script, que tendremos que descargar e instalar a mano, que puede facilitarnos algo el trabajo. Para descargarlo ejecutaremos:

wget http://www.alfredklomp.com/programming/shrinkpdf/shrinkpdf.sh
chmod +x shrinkpdf.sh

Si además queremos que se ejecute desde cualquier ruta y por cualquier usuario:

sudo mv shrinkpdf.sh /usr/bin/shrinkpdf.sh

Ahora ya puedes reducirlo ejecutando:

shrinkpdf.sh pdf-original.pdf pdf-reducido.pdf