Конвертирование jpg в pdf в Linux
Формат jpg несомненно является самым популярным графическим форматом в интернете, однако в некоторых случаях удобнее использовать pdf, так как он может включать как растровую, так и векторную графику. Поэтому качество печати изображений jpg зависит только от их разрешения и степени сжатия, в то время как векторные pdf-файлы можно печатать любого размера. Кроме того, pdf-файлы с текстовым слоем поддерживают поиск по содержимому и могут содержать больше метаданных, чем jpg.
В Linux для конвертирования jpg в pdf вы можете использовать ImageMagic или GhostScript.
Конвертирование jpg в pdf с помощью ImageMagick
Для начала установите ImageMagick.
В пакет ImageMagick входит утилита convert, которая позволяет конвертировать jpg в pdf. Эта команда масштабирует изображение таким образом, чтобы оно соответствовало размеру страницы. Конвертирование осуществляется с помощью команды:
Если вы хотите конвертировать несколько изображений jpg в один pdf-файл (с несколькими страницами), это делается с помощью команды:
Утилита convert также поддерживает различные операции редактирования изображения перед его конвертированием в формат pdf.
С помощью опции «-page» команды convert можно задать размер страницы. Если размер больше, чем размер исходного изображения, оно будет размещено в левом нижнем углу страницы.
Можно также задать размер изображения:
Изменить размер изображения:
Конвертирование jpg в pdf с помощью Ghostscript
Сначала установите ghostscript.
Для конвертирования используется команда gs вида:
Конвертирование нескольких изображений jpg в один файл pdf осуществляется с помощью команды:
Источник
Convert images to PDF on Linux
In this post, we’ll take a look at three different ways on how to convert images to PDF file on Linux.
Gscan2pdf
The first option on our list is to use gscan2pdf app. Gscan2pdf is an open-source app available on all Linux distros and makes converting images to PDF a breeze. We can install it by going to the software centre and searching for gscan2pdf .
After opening the app, click on a folder icon to load images. An error pop-up might show up informing you that you don’t have scanning devices. That’s not a problem, just close it.
Having loaded images, you can customize them if you would like to do so.
The top toolbar includes editing options like:
- Flipping
- Rotating
- Renumbering
- and much more!
Once we are done with editing, we can convert images into a single PDF:
File → Save → Select Document type to PDF → Save.
ImageMagick
ImageMagick is a CLI tool which allows you to convert images to PDF. As a CLI tool, it’s much faster than Gscan2pdf. On top of that, we can automate the whole process!
We can install it with the following command:
After installing it, convert your images to PDF with the following command:
The command above might yield an “operation not allowed” error. Fortunately, we can easily fix it by executing:
After applying the fix, re-run the conversion command!
LibreOffice
The last option on our list is LibreOffice. LibreOffice Draw provides us with a bit cumbersome, but still possible way to convert images to PDF.
The biggest advantage of this approach is also its biggest disadvantage — the ability to arrange images on a page manually. If you just want to have each image on its page without much tweaking, then you should not use LibreOffice Draw for this.
You can import images in LibreOffice Draw by dragging and dropping them from your file manager and customize them as you wish.
Once we’ve finished with editing, we can export our work as PDF:
File → Export as → Export as PDF → Export
Conclusion
In this post, we’ve explored three different ways to convert images to PDF and discussed the pros and cons of each. What is your approach? Share your thoughts with us in the comments section below. 👇
Источник
PDF, PS and DjVu
This article covers software to view, edit and convert PDF, PostScript (PS), DjVu (déjà vu) and XPS files.
Contents
Engines
- Poppler — PDF rendering library based on Xpdf. For CJK (Chinese, Japanese, Korean) support with Poppler, installpoppler-data .
https://poppler.freedesktop.org/ || poppler
- Mupdf — MuPDF is a lightweight PDF, XPS, and EPUB viewer, consisting of a software library, command line tools, and viewers.
https://mupdf.com/ || libmupdf
- libspectre — Small library for rendering Postscript documents.
https://www.freedesktop.org/wiki/Software/libspectre || libspectre
- Ghostscript — Interpreter for PostScript and PDF. Provides the gs(1) command-line interface, see also /usr/share/doc/ghostscript/*/Use.htm (online), along with many wrapper scripts like ps2pdf and pdf2ps.
https://ghostscript.com/ || ghostscript
- DjVuLibre — Suite to create, manipulate and view DjVu documents.
http://djvu.sourceforge.net/ || djvulibre
- libgxps — GObject based library for handling and rendering XPS documents.
https://wiki.gnome.org/Projects/libgxps || libgxps
Viewers
Framebuffer
- fbgs — Poor man’s PostScript/pdf viewer for the linux framebuffer console.
https://www.kraxel.org/blog/linux/fbida/ || fbida
- fbpdf — Small framebuffer PDF and DjVu viewer based on MuPDF, with Vim keybindings and written in C
https://repo.or.cz/w/fbpdf.git || fbpdf-gitAUR
- jfbview — Framebuffer PDF and image viewer. Features include Vim-like controls, zoom-to-fit, a TOC (outline) view and fast multi-threaded rendering.
https://github.com/jichu4n/jfbview || jfbviewAUR
Graphical
- Adobe Reader — Proprietary PDF file viewer offered by Adobe. Discontinued for Linux.
https://www.adobe.com/products/reader.html || acroreadAUR
- apvlv — Lightweight document viewer with Vim keybindings. Supports PDF, DjVu, EPUB, HTML and TXT.
https://naihe2010.github.io/apvlv/ || apvlvAUR
- Atril — Simple multi-page document viewer for MATE. Supports DjVu, DVI, EPS, EPUB, PDF, PostScript, TIFF, XPS and Comicbook.
https://github.com/mate-desktop/atril || atril
- CorePDF — Simple lightweight PDF viewer based on Qt and poppler. Part of C-Suite.
https://cubocore.org/ || corepdfAUR
- Deepin Document Viewer — A simple PDF and DjVu reader, supporting bookmarks, highlights and annotations.
https://github.com/linuxdeepin/deepin-reader || deepin-reader
- DjView — Viewer for DjVu documents.
http://djvu.sourceforge.net/djview4.html || djview
- ePDFView — Lightweight PDF document viewer using the Poppler and GTK libraries. Development stopped.
http://freecode.com/projects/epdfview || epdfview
- Emacs — See also pdf-tools for improved pdf support ( emacs-pdf-tools-gitAUR ) and the djvu package for djvu support.
https://www.gnu.org/software/emacs/ || emacs
- Evince — Document viewer for GNOME. Supports DjVu, DVI, EPS, PDF, PostScript, TIFF, XPS and Comicbook.
https://wiki.gnome.org/Apps/Evince || evince
- Foxit Reader — Small, fast (compared to Acrobat) proprietary PDF viewer. Discontinued for Linux.
https://www.foxitsoftware.com/pdf-reader/ || foxitreaderAUR
- gv — Graphical user interface for the Ghostscript interpreter that allows to view and navigate through PostScript and PDF documents.
https://www.gnu.org/software/gv/ || gv
- llpp — Very fast PDF reader based off of MuPDF, that supports continuous page scrolling, bookmarking, and text search through the whole document.
https://repo.or.cz/w/llpp.git || llpp
- MuPDF — Very fast EPUB, FictionBook, PDF, XPS and Comicbook viewer written in portable C. Features CJK font support.
https://mupdf.com/ || mupdf
- Okular — Universal document viewer for KDE. Supports CHM, Comicbook, DjVu, DVI, EPUB, FictionBook, Mobipocket, ODT, PDF, Plucker, PostScript, TIFF and XPS.
https://okular.kde.org/ || okular
- pdfpc — Presenter console with multi-monitor support for PDF files.
https://pdfpc.github.io/ || pdfpc
- qpdfview — Tabbed document viewer. It uses Poppler for PDF support, libspectre for PS support, DjVuLibre for DjVu support, CUPS for printing support and the Qt toolkit for its interface.
https://launchpad.net/qpdfview || qpdfview
- Xpdf — Viewer that can decode LZW and read encrypted PDFs.
https://www.xpdfreader.com/ || xpdf
- Xreader — Document viewer part of the X-Apps Project. Supports DjVu, DVI, EPUB, PDF, PostScript, TIFF, XPS, Comicbook.
https://github.com/linuxmint/xreader/ || xreader
- Zathura — Highly customizable and functional document viewer (plugin based). Supports PDF, DjVu, PostScript and Comicbook.
https://pwmt.org/projects/zathura/ || zathura
Comparison
The factual accuracy of this article or section is disputed.
Asterisk next to library denotes optional dependency needs to be installed for specified feature.
Name | PostScript | DjVu | XPS | PDF forms | PDF Annotation | License | |
---|---|---|---|---|---|---|---|
Adobe Reader | Custom | – | – | – | Yes | – | proprietary |
apvlv | Poppler | – | DjVuLibre | – | No | – | GPLv2 |
Atril | Poppler | libspectre | DjVuLibre | libgxps | Yes | – | GPLv2 |
DjView | – | – | DjVuLibre | – | – | – | GPLv2 |
Emacs | Ghostscript* | DjVuLibre* | – | No | Yes | GPLv3 | |
ePDFView | Poppler | – | – | – | No | – | GPLv2 |
Evince | Poppler | libspectre | DjVuLibre | libgxps | Yes | Yes | GPLv2 |
Foxit Reader | Custom | – | – | – | Yes | Yes | proprietary |
gv | Ghostscript | – | – | No | – | GPLv3 | |
llpp | libmupdf | – | – | libmupdf | Yes | – | GPLv3 |
MuPDF | Custom | – | – | Custom | Yes | Yes | AGPLv3 |
Okular | Poppler | libspectre | DjVuLibre | Custom | Yes | Yes | GPL, LGPL |
pdfpc | Poppler | – | – | – | No | – | GPLv2 |
qpdfview | Poppler | libspectre* | DjVuLibre* | – | Yes | Yes | GPLv2 |
Xpdf | Custom | – | – | – | No | – | GPLv3 |
Xreader | Poppler | libspectre* | DjVuLibre* | libgxps* | Yes | Yes | GPLv2 |
Zathura | Poppler* / libmupdf* | libspectre* | DjVuLibre* | libmupdf* | No | – | zlib |
PDF forms
The PDF forms column in the above table refers to AcroForms support. If you do not need your input to be directly extractable from the PDF, you can also use the applications in #Annotation or #Graphical PDF editing to put text on top of a PDF. PDF forms can be created with LibreOffice Writer (View > Toolbars > Form Controls) and the advanced PDF editors.
The proprietary and deprecated XFA format for forms is not fully supported by Poppler[1][2] and only supported by Adobe Reader and Master PDF Editor.
Alternatively, web browsers such as Firefox or Chromium feature a built-in PDF viewer capable of filling out forms.
Источник