Giter Club home page Giter Club logo

pdfarranger's Introduction

About

CodeQL Codacy Badge pdfarranger codecov

PDF Arranger is a small python-gtk application, which helps the user to merge or split PDF documents and rotate, crop and rearrange their pages using an interactive and intuitive graphical interface. It is a front end for pikepdf.

PDF Arranger is a fork of Konstantinos Poulios’s PDF-Shuffler (see Savannah or Sourceforge). It’s a humble attempt to make the project a bit more active.

For more info see User Manual.

screenshot of PDF Arranger

Downloads

PDF Arranger for Windows Download on Flathub Get it from the Snap Store More…

Linux and BSD packages

Linux packages

Install from source

PDF Arranger requires pikepdf >= 6. Pip will automatically install the latest pikepdf if there is no pikepdf installed on the system.

On Debian-based distributions

sudo apt-get install python3-pip python3-wheel python3-gi python3-gi-cairo \
    gir1.2-gtk-3.0 gir1.2-poppler-0.18 gir1.2-handy-1 python3-setuptools

On Arch Linux

sudo pacman -S poppler-glib python-pip python-gobject gtk3 python-cairo libhandy

On Fedora

sudo dnf install poppler-glib python3-pip python3-gobject gtk3 python3-cairo \
    python3-wheel python3-pikepdf python3-img2pdf python3-dateutil libhandy

On FreeBSD

sudo pkg install devel/gettext devel/py-gobject3 devel/py-pip \
    graphics/poppler-glib textproc/py-pikepdf x11-toolkits/gtk30 \
    x11-toolkits/libhandy

Then

pip3 install --user --upgrade https://github.com/pdfarranger/pdfarranger/zipball/main

In addition, PDF Arranger supports image file import if img2pdf is installed.

For developers

git clone https://github.com/pdfarranger/pdfarranger.git
cd pdfarranger
./setup.py build
python3 -m pdfarranger

For Windows see Win32.md.

For translators

  • Download the main branch (see For developers)

  • Run po/genpot.sh. The pot is an automatically generated file and as such should not be in the repository. It is to make life of some translators easier, but it might be out of sync with the source code. If you can regenerate it before adding or updating a translation, then do it.

  • Translations are in the following files:

  • For mnemonics accelerators (letters preceded by an underscore) try to follow those rules by priority order:

    • be consistent with other GTK/GNOME software
    • pick a unique letter within that given menu if possible
    • pick the same letter as the original string if available
    • pick a strong letter (e.g. in "Search and replace" rather pick s, r or p than a)
  • If possible, test your translation to see it in context (see For developers)

  • Do not include pdfarranger.pot (or any *.po file which was just automatically regenerated) in your pull request. Submit only the translations you actually updated or added.

  • If you don’t want or can’t use the developers tooling (git, po/genpot.sh, python, …) you can edit, download or upload the *.po files from the GitHub web pages.

pdfarranger's People

Contributors

albanobattistella avatar angsch avatar dependabot[bot] avatar dreua avatar emintufan avatar fabaff avatar hugok79 avatar jeromerobert avatar juxuanu avatar kbengs avatar logari81 avatar m-holger avatar mapi68 avatar milotype avatar mimi89999 avatar oersen avatar oscfdezdz avatar ovari avatar pavelzahradnik avatar ser82-png avatar sicklylife-jp avatar smarquespt avatar soumyadghosh avatar superboa avatar sveinki avatar tuliocaesar avatar vistaus avatar vovkiv avatar wcxu21 avatar zsugabubus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdfarranger's Issues

Keep original metadata

When I save edited PDF documents, the original metadata is lost. There is no way to keep the original title, author, keywords, creation date etc. It would be a nice feature to keep these metadata on save/export, or even allow to edit these fields.

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

One more minor little thing, stdout on "File -> Save":

Gtk-Message: GtkDialog mapped without a transient parent. This is discouraged.

I think, adding parent=self.window on line 473 in pdfshuffler.py fixes this.

chooser = Gtk.FileChooserDialog(title=_('Export ...')
parent=self.window,
action=Gtk.FileChooserAction.SAVE,
[...]

But I have no clue about python, except what I googled about the last few days.

So you surely know better. :-)
Btw: Thank you for one of the few really usefull applications, it saved me hours of work.

Best regards

Tag a new release?

The port to gtk3/python3 is a huge improvement for this great tool, it is really worth a release. Many distributions (e.g. Debian) normally package only "official" releases, so the new features won't make it in the next release if a version is not tagged.

How to install in Fedora 24

Hi,

how can I install this on Fedora 24?

There is no package with the name python-cairo (only pycairo).

If i try it anyway i get this

KDEInit kann „pdfshuffler“ nicht starten:
Bibliothek „libkdeinit5_pdfshuffler“ lässt sich nicht öffnen.
Cannot load library libkdeinit5_pdfshuffler: (libkdeinit5_pdfshuffler: cannot open shared object file: No such file or directory)

some translations are missing

I'm not sure, if the translation of some text is left out on build time or simple not yet done.

Top Menu = File -> Import -> Window titel "Import..." not translated -> "PDF files / All files" not translated.
Top Menu = File -> Save -> "PDF files / All files" not translated.
Top Menu = Help -> Info -> About Text not translated (and the Icon is missing).
Main window = Right click on a thumbnail -> Rotate/Crop/Delete/Export selections not translated.

I'm happy to provide translation for "de", but i found all strings already translated in the "de.po" file.

best regards

steveje

Merge double sided scanned document

I often have to scan double sided documents. I scan one side then the other. Finnally I merge them using PDFSam which has the functionality to properly arrange double sided documents on merge.

I'd rather use pdfarranger for that task.

name 'file' is not defined

Hi There,

pdfshuffler is now starting but when exporting selections I reproducable get the following error:

name 'file' is not defined

Sascha

Option to zoom to full page

Upon starting the programme, it would be nice if I had the option to make it zoom so as to display as much as possible of the first page, not just thumbnails.

Release as a Flatpak package

Hi,

It would be great if you could package PDFarranger in a flatpak package (see https://flatpak.org/ for info/documentation).
That way non techy users would be able to install the application without having to install separate packages. I also recommend a flatpak package because it is distribution independent, avoids dependency problems and incompatibilities with older/newer Linux distribution versions, and allows sandboxing for additional security.

Thanks

Simple enhancements

I have some simple adjustments but it would take me some time to get to know Gtk framework to implement this myself.

  1. Shift+click consecutive pages instead of rectangular selection (sf)
    explanation with images
  2. Drag should move ALL selected pages (sf, savannah)
    Select multiple pages, drag to different position -> should drag all selected pages and not only one.
  3. Option to duplicate page(s) (sf, savannah)
    Add a right-click option to duplicate selected page(s).

Drag should move all selected pages

Select multiple pages, drag to different position -> should drag all selected pages and not only one. (sf, savannah) (quoting @darkdragon-001)

When starting the drag one must click on one page of among those who are selected. The problem is that clicking on an already selected icon in a Gtk IconView, unselect it.

Here are the only relevant pages Google gave to me:

The first one is about TreeView and I was not able to adapt it to IconView. The second one still have no answer.

Thunar is using Gtk3 and properly handle multi-selection in IconView but they are exo IconView, not plain Gtk IconView.

I need help on that bug. If someone know a simple Gtk application (even better a pyGtk one) that properly handle multi-section in IconView that would help.

default save and replace original file

I wish it could behave like all file modifiers: upon closing should warns about replacing the original file and save the modified file.
using ubuntu 19.04, could be realted to file attributes?

Support for jpg and png

Support to attach images jpg and png as a page, to merge with PDFs, simply convert image to pdf (how fronted of img2pdf), or combined several images as pages of one PDF, a lot of new features.

The Python library img2pdf can do the job. According to img2pdf on Gitlab, a pseudo-code could be:

if extension_file is jpg/png:
	import img2pdf
	# specify paper size (A4)
	a4inpt = (img2pdf.mm_to_pt(210),img2pdf.mm_to_pt(297))
	layout_fun = img2pdf.get_layout_fun(a4inpt)
	# convert the image to pdf page
	with open("imageTOconvert","wb") as f:
		f.write(img2pdf.convert('temporaryPDF.pdf', layout_fun=layout_fun))
	# open/add the PDF created with the current code of Pdfarranger
	......
	# remove the file created by img2pdf after adding it or when exit Pdfarranger
	import os
	os.remove("temporaryPDF.pdf")

It is also necessary:

  1. Add img2pdf as dependency (available in the official Ubuntu/Archlinux/Manjaro/others repositories).
  2. When clicking on open/add a pdf, add .png and .jpg to the list of extensions to search.
  3. Change README.md for mention the new features and "frontend for python-pyPdf and img2pdf".

error on startup, cannot use any button

when I pull the master and try to launch it I get this:

$ python3 -m pdfarranger
Traceback (most recent call last):
  File "/home/arbeit/Programmierkram/GitHub/pdfarranger/pdfarranger/pdfarranger.py", line 396, in do_activate
    self.__create_actions()
  File "/home/arbeit/Programmierkram/GitHub/pdfarranger/pdfarranger/pdfarranger.py", line 204, in __create_actions
    ('quit', self.on_quit),
TypeError: Item 0: argument self: Expected Gio.ActionEntry, but got tuple

all buttons are greyed out all the time and makes it unusable

OS is Ubuntu 18.04 with Python 3.6.7
I have the same issue on a openSUSE Leap 15 system

Oh, and I just realized that we should also try to fix the current master. Could you provide some information what's wrong?

Originally posted by @dreua in #62 (comment)

Close temporary files before deleting them

Here we delete the temporary directory but files in there are still open. This go unnoticed on Linux but break on Windows.

I don't know yet which part of the code is keeping those files open.

Notifying @carlos22 as he is the first one to have worked on this issue
Ref #11 #16

Space at the right border

In comparison to the left side, the space from the preview thumbnail to the right border of the app is much bigger, as shown here. Ideally, this distance should be equal on both sides. This would ensure a consistent look.

Happens with the 1.1.1 version on Ubuntu 18.10.

Merge windows branch

I'v seen, there is a branch called "windows". Please merge this into master if possible and state that windows is supported, too. Thanks.

Zooming does not re-render file

If I zoom in on a file, it seems as if the thumbnail is blown up, but not actually recomputed, causing rather blurred pages.

Proper Windows builds (Installer etc.)

Meld is also pygobject based and offers a windows installer.
Installer: https://ftp.gnome.org/pub/GNOME/binaries/win32/meld/3.18/ (requires vcredist 2010 SP1)
Appveyor file: https://gitlab.gnome.org/GNOME/meld/blob/3.18.2/appveyor.yml
Setup file: https://gitlab.gnome.org/GNOME/meld/blob/3.18.2/setup_win32.py

Not sure if poppler of pygi-aio is working correctly.

This might be a way to go? The current approach using msys2 is good for developers but not very useful for the average user.

Error at save

I'm trying to make a 4 pages pdf file.
When saving, it shows this error:

Multiple definitions in dictionary at byte 0xd65 for key /x10

The file won't get saved.

Captura de pantalla de 2019-04-04 14-32-39

Switch to Gtk.Application

Working on #52 and #44 I have the feeling that pdfarranger should first use the UI action concept. It should be straightforward to introduce Gtk.Action but it's deprecated so I would prefer to invest time on Gtk.Application. This looks like a somehow intrusive and long work so this issue, #52 and #44 will probably remain open for a while.

outdated po files

The German translation is incomplete. First I wanted to create a simple pull request but then I noticed that the po files are outdated. So I updated the po files with the provided shell scripts and completed the German translation.

The result is in the attachment (renamed because github doesn't allow po files):
de.po.txt

Rebranding

Rename pdfshuffler to pdfarranger so fork looks like more official

Drop python 2 support after the next release

This issue is to survey the community about dropping the python 2 support. My intention is to keep python 2 compatibility until the next release, then to only ensure python 3 after. If it's not good for you please, give arguments.

Rename display name?

The name in the .desktop and About dialog is pdfarranger.

Most GUI apps in a typical Linux desktop use capitalized names.

Would you be interested in renaming the display name to something like PDF Arranger?

The command-line name can stay as is.

For reference, I believe pdfshuffler's display name was PDF-Shuffler.

Can't load icon. Application is not installed correctly.

Hi,...

on startup pdfshuffler I get "Can't load icon. Application is not installed correctly." and the icon in "Help -> Info" is not displayed. Also the issue with "name 'file' is not defined" happens for me too. I can't save any document.

best regards

Thumbnail placement

Shuffler used to display the thumbnail table both vertically and horizontally centered. In Arranger, the table is apparently always left aligned, but vertically still centered. Personally, I'd prefer left/top alignment, simply because that's what I'm used to from other software (file managers, gThumb...)

Remember window size

The program always opens a rather small window here (PDFA 1.1.1 on Debian Testing XFCE) that shows only eight thumbnails. I always have to resize it to something more useful before I can start working on a PDF.

Request: Have PDF Arranger remember the window's size and the maximised status,

(btw. awesome job on the update - PDF Shuffler with GTK3 and proper Shift-Click? Awesome, thanks! )

Install by hand in Xenial program fails to start

Hello,

when trying to start the program from within the menus (lxde menus), I get:

"Fichier d'entrée de bureau invalide : '/home/melodie/.local/share/applications/pdfarranger.desktop'".

When trying to start it from a console, invoking an argument:
$ pdfarranger sysadd2.pdf
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2299, in resolve
return functools.reduce(getattr, self.attrs, module)
AttributeError: module 'pdfarranger.pdfarranger' has no attribute 'main'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/melodie/.local/bin/pdfarranger", line 11, in
load_entry_point('pdfarranger==1.1.1', 'console_scripts', 'pdfarranger')()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 561, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2631, in load_entry_point
return ep.load()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2291, in load
return self.resolve()
File "/usr/lib/python3/dist-packages/pkg_resources/init.py", line 2301, in resolve
raise ImportError(str(exc))
ImportError: module 'pdfarranger.pdfarranger' has no attribute 'main'
$

I used the howto from the main page to install:
"On Debian based distributions:

sudo apt-get install python3-distutils-extra python3-wheel python3-gi python3-gi-cairo gir1.2-gtk-3.0 gir1.2-poppler-0.18 python3-setuptools
"
and

"pip3 install --user -r https://raw.githubusercontent.com/jeromerobert/pdfarranger/master/requirements.txt"

How can I fix it?

Can't drag and drop a file from a filer

If I drag and drop a pdf from e.g. pcmanfm, I get this error message in the terminal:

#  pdfshuffler
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pdfshuffler/pdfshuffler.py", line 866, in sw_dnd_received_data
    filename = self.get_file_path_from_dnd_dropped_uri(uri)
  File "/usr/lib/python3.5/site-packages/pdfshuffler/pdfshuffler.py", line 914, in get_file_path_from_dnd_dropped_uri
    path = urllib.url2pathname(uri) # escape special chars
AttributeError: module 'urllib' has no attribute 'url2pathname'

It seems I need to modify lines 32 and 914 to use urllib.request rather than the old urllib used with Python2.
But then I get this error message, which I haven't solved yet:

#  pdfshuffler
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/pdfshuffler/pdfshuffler.py", line 866, in sw_dnd_received_data
    filename = self.get_file_path_from_dnd_dropped_uri(uri)
  File "/usr/lib/python3.5/site-packages/pdfshuffler/pdfshuffler.py", line 914, in get_file_path_from_dnd_dropped_uri
    path = urllib.request.url2pathname(uri) # escape special chars
  File "/usr/lib/python3.5/urllib/request.py", line 1576, in url2pathname
    return unquote(pathname)
  File "/usr/lib/python3.5/urllib/parse.py", line 537, in unquote
    if '%' not in string:
TypeError: a bytes-like object is required, not 'str'

invalid literal for int() with base 10 b'612,000000'

Hi, I'm using pdfarranger on Manjaro Linux. I have a PDF with 2 pages. After I selected the last page for deletion it went ok, but when I save (using either 'Save' or 'Save As' options), got this error:
invalid literal for int() with base 10 b'612,000000'
It could be related to pypdf instead but I don't know, I'm not a Python developer 😟.
Hope it can helps.

Consider using PyPDF2 strict=False mode

This error occurs for me in the ppa version and when built from source on python3 wen saving a one-page pdf which has cropping applied (10% to top and bottom).

image

gtk3 and gtk3-classic are in conflict

Arch / manjaro

~ >>> sudo pacman -S poppler-glib gettext python-pip python-gobject gtk3 python-cairo

warning: poppler-glib-0.71.0-1 is up to date -- reinstalling
warning: gettext-0.19.8.1-3 is up to date -- reinstalling
warning: python-gobject-3.30.1-3 is up to date -- reinstalling
warning: python-cairo-1.17.0-2 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...
:: gtk3 and gtk3-classic are in conflict (gtk3-print-backends). Remove gtk3-classic? [y/N] n
error: unresolvable package conflicts detected
error: failed to prepare transaction (conflicting dependencies)
:: gtk3 and gtk3-classic are in conflict

Command "python setup.py egg_info" failed

Install fails with this message;

` pip3 install --user -r https://raw.githubusercontent.com/jeromerobert/pdfarranger/master/requirements.txt

Collecting https://github.com/jeromerobert/pdfarranger/zipball/master (from -r https://raw.githubusercontent.com/jeromerobert/pdfarranger/master/requirements.txt (line 1))
Downloading https://github.com/jeromerobert/pdfarranger/zipball/master
| 686kB 7.3MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-req-build-b70g4cf6/setup.py", line 27, in
from DistUtilsExtra.command import *
ModuleNotFoundError: No module named 'DistUtilsExtra'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-req-build-b70g4cf6/
`

Correct a German translation

The German translation for "Export selection..." is currently "Markierte Seiten Exportieren …". It should be changed to "Markierte Seiten exportieren …" = the last word should start with a small letter.

[win32] distutils-extra support

  • Need to add distutils-extra to Win32.md
  • distutils-exta call intltool-update which is a perl script and mingw python subprocess.call does not support the perl shebang (the msys python does)

'Reverse Order' not greyed out with no pages selected

The 'Reverse Order" menu item only has an effect if more than one page is selected. it is correctly greyed out when only one page is selected, but active when no pages are selected (i.e. right after loading a PDF).

pip install fails since usage of DistUtilsExtra.auto

Since 2077a73 I can not install with pip3.
Here is a log of the failing installation (with -v): pip_log_error.txt
Here is a log installing the last working version (with -v): pip_log_ok.txt

What I tried so far:

  • update distutils, install wheel
  • remove import of pyPdf since the log says ERROR: Python module pyPdf not found
  • Note that both versions contain --single-version-externally-managed but only the new doesn't recognize it.

Am I the only one having this problem?

Start problems

pdfshuffler
sys:1: PyGIWarning: Poppler was imported without specifying a version first. Use gi.require_version('Poppler', '0.18') before import to ensure that the right version gets loaded.
Error: Could not import pdfshuffler
Cause: No module named 'pdfshuffler_iconview'

Any help would be aprreciated.

Best regards
Sascha

Error with file with special characters

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/jerome/pdfshuffler/pdfarranger/pdfarranger/__main__.py", line 3, in <module>
    pdfarranger.main()
  File "pdfarranger/pdfarranger.py", line 1290, in main
    PdfArranger()
  File "pdfarranger/pdfarranger.py", line 305, in __init__
    self.add_pdf_pages(filename)
  File "pdfarranger/pdfarranger.py", line 477, in add_pdf_pages
    pdfdoc = PDFDoc(filename, self.nfile, self.tmp_dir)
  File "pdfarranger/pdfarranger.py", line 1244, in __init__
    self.document = Poppler.Document.new_from_file(file_prefix + self.copyname, None)
gi.repository.GLib.Error: g_convert_error: The URI “file:///tmp/tmpdUTavkpdfarranger/01_cou%zrer$ff.pdf” contains invalidly escaped characters (4)

Solutions: https://stackoverflow.com/questions/11687478/convert-a-filename-to-a-file-url
Ref: https://sourceforge.net/p/pdfshuffler/bugs/34/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.