2

Have a very beginner question here. I have downloaded the module "pdf-diff"(https://pypi.org/project/pdf-diff/) for Python and can get it to execute in the terminal fine. However, I wish to call the command in a Python script that I am writing. The script is comparing multiple pdf files over a for loop and I want it to generate one of the pdf-diff reports for each one.

How can I find which argument to call in my Spyder console?

Thank you.

2 Answers 2

2

As I checked the pdf-diff module, it seems it just running using the command-line. also, the owner JoshData said that he doesn't maintain the project anymore. So if you want to use in python you have 2 choices:

1 - using bash command in python using subprocess module.

2 - install pdf_diff and use this code

from pdf_diff import command_line

# 'strike,underline' for style is the default value
# 'png' for format is the default value
# 0 , 100 , 900 for top_margin ,bottom_margin  , width are default values
style = 'strike,underline'.split(',')
format = 'png'
changes = command_line.compute_changes('/path/to/pdf/file/1.pdf', '/path/to/pdf/file/2.pdf',top_margin=0,bottom_margin=100)
img = command_line.render_changes(changes, style, width=900)
img.save('/path/for/saving/name', format.upper())

Sign up to request clarification or add additional context in comments.

Comments

1

You should import it as a module in Spyder console. and then call it.

Something like this:

import pdf-diff

pdf-diff **argument**

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.