Skip to content

Instantly share code, notes, and snippets.

@sdelquin
Created July 22, 2021 16:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sdelquin/e0dc721c25b194dfc11e994cca0d3cd2 to your computer and use it in GitHub Desktop.
Save sdelquin/e0dc721c25b194dfc11e994cca0d3cd2 to your computer and use it in GitHub Desktop.
Check tools from pylovepdf
import os
import sys
from prettyconf import config
from pylovepdf import ILovePdf
PUBLIC_KEY = config('ILOVEPDF_PUBLIC_KEY')
# tool names as described in https://github.com/AndyCyberSec/pylovepdf#tools
TOOLS = [
'compress',
'imagepdf',
'merge',
'officepdf',
'pagenumber',
'pdfa',
'pdfjpg',
'protect',
'rotate',
'split',
'unlock',
'validatepdfa',
'watermark',
]
ilovepdf = ILovePdf(PUBLIC_KEY, verify_ssl=True)
for tool in TOOLS:
sys.stdout = open(os.devnull, 'w')
try:
task = ilovepdf.new_task(tool)
task.debug = False
task.delete_current_task()
except Exception as err:
sys.stdout = sys.__stdout__
print(f'TOOL: {tool}')
print(err)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment