Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for jpg and png #45

Closed
aposuit opened this issue Jan 13, 2019 · 3 comments
Closed

Support for jpg and png #45

aposuit opened this issue Jan 13, 2019 · 3 comments
Labels
feature Request for a new feature
Milestone

Comments

@aposuit
Copy link

aposuit commented Jan 13, 2019

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".
@stavpup
Copy link

stavpup commented Jan 14, 2019

I am against this idea, prefer to keep it with the features of pdf shuffler.

@aposuit
Copy link
Author

aposuit commented Jan 14, 2019

What is the point of copying Pdf Shuffler, rebranding, and not making relevant improvements that justify the fork? Especially being easy to program and not affecting to the features provided by Pdf Shuffler.

I do not know enough of Python, implement the idea depends on others, it's their decision.

@jeromerobert
Copy link
Member

I won't work on that feature as I prefer to keep using imagemagick or img2pdf in command line than using pdfarranger. But if someone do it and manage to make the dependencies (img2pdf or whatever) optional (in the python code and in the setup.py), I'll integrate his work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Request for a new feature
Projects
None yet
Development

No branches or pull requests

4 participants