alwaysaugust Posted May 2, 2017 Share Posted May 2, 2017 Oh nice, I actually just posted on the other workflows GitHub seeing if 2016 support was possible and he said no. I agree that it isn't really a good fit for APT I was just naming features of ilovepdf.com that are useful. xilopaint 1 Link to comment
maffy Posted June 5, 2017 Share Posted June 5, 2017 Is there any way to run the Merge function without deleting the original files after merge? Link to comment
xilopaint Posted June 5, 2017 Author Share Posted June 5, 2017 (edited) Currently the source files are moved to trash after merging so it's not possible. However it can be easily implemented. Give me a couple days and I will add the feature in the next release. Edited June 13, 2017 by xilopaint cands 1 Link to comment
xilopaint Posted June 12, 2017 Author Share Posted June 12, 2017 (edited) Update (v2.4): Improved merge feature Added ability to merge the selected PDF files without moving them to Trash. Use the ⌘ modifier key instead if you want to move them to Trash after merging. Edited June 12, 2017 by xilopaint Link to comment
maffy Posted June 12, 2017 Share Posted June 12, 2017 This is awesome! Thank you! xilopaint 1 Link to comment
xilopaint Posted June 15, 2017 Author Share Posted June 15, 2017 (edited) Update (v2.4.1): Minor fix Fixed an issue that prevented notifications to be posted when the merge file action was followed by the ⌘ modifier key. Edited June 15, 2017 by xilopaint Link to comment
xilopaint Posted June 29, 2017 Author Share Posted June 29, 2017 Update (v2.4.2): Bug fix Fixed a bug that could create empty output files when splitting or slicing certain PDF files. Link to comment
xilopaint Posted September 8, 2017 Author Share Posted September 8, 2017 (edited) @deanishe The Optimize action of this workflow executes a subprocess called k2pdfopt. While running, this subprocess outputs the progress of the operation (tipically informing the conclusion of each page of the PDF file). Look: Since the operation can take a long time in larger PDF files it would be very neat to show the progress of the operation in Alfred bar, maybe invoking a Script Filter or something that can inform how many pages were processed. Do you know if it's possible to retrieve the output of the subprocess for this purpose? Edited September 8, 2017 by xilopaint Link to comment
deanishe Posted September 8, 2017 Share Posted September 8, 2017 (edited) You can read the "SOURCE PAGE X of 4" lines by capturing the STDOUT/STDERR output of the process. Here's a bit of code from a program I wrote that does something similar: proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while True: if proc.poll() is not None: # subprocess has finished break line = proc.stdout.readline().strip() if not line: continue # parse output here Edited September 8, 2017 by deanishe xilopaint 1 Link to comment
xilopaint Posted September 8, 2017 Author Share Posted September 8, 2017 (edited) Thank you, @deanishe. I had already read a similar solution here. My problem is my subprocess is executed from a Run Script object and I need the capability of invoking a Script Filter whenever I want to check the progress (what can happen multiple times in a single execution with large files) . How can I better achieve this? Should I write the output of the subprocess in a file and retrieve the data with the Script Filter or there is any better way? Edited September 8, 2017 by xilopaint Link to comment
deanishe Posted September 8, 2017 Share Posted September 8, 2017 Yup. Writing the status to a file is probably the best way. Another possibility is to start a server for your Script Filter to fetch the status from, but that seems like overkill. xilopaint 1 Link to comment
xilopaint Posted September 8, 2017 Author Share Posted September 8, 2017 (edited) 6 hours ago, deanishe said: Yup. Writing the status to a file is probably the best way. Another possibility is to start a server for your Script Filter to fetch the status from, but that seems like overkill. I tried to use settings API of alfred-workflow and had some issues. In some tests the last line of the subprocess output was not added to settings.json file. Using "with statements" to write and open the files I had no issues. Is wf.settings somewhat slow or bad for using in loops? This is working well: proc = Popen(command, shell=True, stdout=PIPE) page_number = 1 while proc.poll() is None: line = proc.stdout.readline() if "SOURCE PAGE" in line: with open(file_page_number, 'w') as f2: f2.write(str(page_number)) page_number = page_number + 1 But this is not always working: proc = Popen(command, shell=True, stdout=PIPE) page_number = 1 while proc.poll() is None: line = proc.stdout.readline() if "SOURCE PAGE" in line: wf.settings['page_number'] = str(page_number) page_number = page_number + 1 I would like to use wf.settings if possible, but it seems unreliable in my tests. I should be missing something. Edited September 8, 2017 by xilopaint Link to comment
deanishe Posted September 8, 2017 Share Posted September 8, 2017 (edited) You shouldn't use the settings API because each Workflow instance assumes it's the only one accessing the settings.json file and will overwrite changes made by other instances/processes running at the same time. It's a bad choice anyway: the settings are persistent data, meant to be kept as long as the workflow is installed. Such data very clearly belong in the cache directory. It's not as if Workflow.cache_data() is any harder to use. Edited September 8, 2017 by deanishe xilopaint 1 Link to comment
xilopaint Posted September 8, 2017 Author Share Posted September 8, 2017 Workflow.cache_data() worked perfectly. Thanks again @deanishe! Link to comment
xilopaint Posted September 10, 2017 Author Share Posted September 10, 2017 (edited) Update (v2.5): Ability to track the optimization process Added script filter to track the optimization process by the keyword progress, especially useful for large files. Edited September 10, 2017 by xilopaint Link to comment
xilopaint Posted September 11, 2017 Author Share Posted September 11, 2017 Update (v2.5.1) Bug fix Fixed a bug in the batch optimization flow. Link to comment
xilopaint Posted September 12, 2017 Author Share Posted September 12, 2017 Update (v2.6) Improved notifications Link to comment
xilopaint Posted September 21, 2017 Author Share Posted September 21, 2017 Update (v2.7) Removed support for OneUpdater. From now Alfred PDF Tools relies on Alfred-Workflow library for self-updating. Significant code improvements for better stability and maintenance. Link to comment
xilopaint Posted October 11, 2017 Author Share Posted October 11, 2017 Update (v2.8) Added file action to decrypt PDF files. 2pilvic 1 Link to comment
xilopaint Posted October 16, 2017 Author Share Posted October 16, 2017 (edited) Update (v2.9) Added progress bar for a more friendly tracking of the Optimize action. Thanks @jeffsui for the sample workflow and @deanishe for his contribution in that thread: _ Edited October 16, 2017 by xilopaint Link to comment
xilopaint Posted February 27, 2018 Author Share Posted February 27, 2018 (edited) Update (v2.10) Added a Crop file action to convert two-column pages in single pages. Fixed a bug that affects some file actions once the PDF file contains links. Edited February 27, 2018 by xilopaint Link to comment
xilopaint Posted February 28, 2018 Author Share Posted February 28, 2018 Update (v2.11) Added a tag environment variable to the configuration sheet allowing the user to set his own tag for filenames once split and slice file actions output multiple files (part is default). Link to comment
xilopaint Posted March 7, 2018 Author Share Posted March 7, 2018 (edited) Update (v2.12) Fixed a critical bug in Split by File Size action that under certain circumstances created files in infinite loop. Improved performance of Split by File Size and Optimize file actions. Renames to suffix the environment variable in workflow’s configuration sheet. Edited March 8, 2018 by xilopaint Link to comment
xilopaint Posted March 9, 2018 Author Share Posted March 9, 2018 Update (v2.12.1) General code improvements. Link to comment
brrrrrr Posted March 11, 2018 Share Posted March 11, 2018 Is there a way to add OCR either via Adobe Acrobat or (preferably) via available GitHub resources? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now