I need to change the author of a PDF file on my Mac. I have tried to use grep and sed to accomplish this, but haven't succeeded.
If I open a PDF file in Preview.app and go to Tools > Show Inspector I see "Author: yonatan".
Is it possible to use Terminal.app to change this string?
Thanks
P.S. I know I can create a new User Account on my Mac or use Adobe Acrobat Professional.
open Automator & create a New Workflow
search "spec" & add Get Specified Finder Items
search "meta" & add Set PDF Metadata
drag-drop the desired PDFs onto the Get Specified Finder Items area
in the Set PDF Metadata area, update the metadata
in the upper-right corner, click [Run]
For more detail see the screenshot below:
A better way would be to make use of exiftool, which on Mac you could install with use of Homebrew:
brew install exiftool
You would then edit your metadata in your PDF in the following manner:
exiftool -Title="Change This Title" -Subject="Fun and PDF" change_my_meta.pdf
Removing metadata
If you only want to remove metadata you can use pdf-redact-tools:
pdf-redact-tools --sanitize untrusted.pdf
You could use Automator. I dont think that sed is going to work because pdfs are largely binary, or very jumbled at the least. One of the defined 'pdf' actions in Automator is defining metadata, one field which is author. Then call the automator workflow with terminal, or just save the workflow as a droplet.
Having used the proposed methods, I obtained a decrease in quality of my paper (using pdf-redact-tools).
For me, using MacOS, the best way to irreversibly remove all metadata from a pdf was performed using both exiftool and qpdf, as follows.
replace metadata with nulls
exiftool -all:all= CLEAN_file.pdf -overwrite_original
linearize the pdf to remove the old metadata (which were replaced with nulls), preventing from restoring of these metadata:
qpdf --linearize file_from_exif.pdf file_out.pdf
Related
I need a/the AppleScript (not automator) command(s) that will burn a single PDF file (stored as a POSIX path) to a CD with a specified Disc Name (also stored in an AppleScript variable).
Today … I right click on a PDF file (mySpecial.pdf) in Finder and click Burn "mySpecial.pdf" to Disc… I then provide the name/title for the disc "Jimbo’s Special Disc" and click on Burn.
Thank you #matt. I did try drutil before posting my question. When I try this …
drutil burn ./test.PDF
I get the following:
Burning Image to Disc: ./test.pdf
Must specify a valid unmounted image path (dmg, iso, cue/bin, and toc).
Everything I’ve found so far seems to only refer to entire directories/folders or image file, not plain old data files.
I need a custom file format for my application and I thought that I could make a superset of PNG. macOS shows previews of regular PNG files (and APNGs with a .png extension) in Finder. I want macOS to show a preview of my file format even though it doesn't have a .png extension. I need to tell macOS that files with a .px2 extension are valid PNGs that can be decoded by a regular PNG decoder.
I've been reading this page trying to find the right set of keys to use but I'm not having any luck. I thought that NSExportableTypes might be the answer but that doesn't seem to be it.
To test this, I'm changing the extension of an APNG file from .png to .px2. I realise that I could just use the .png but I think that could be a little confusing (both for the user and the OS).
There's a slight chance that what I'm trying to do is impossible!
I think you may be looking at 2 different problems: one is the OS recognizing the file type and linking it to your application, the other is being able to show the preview.
The latter is going to be highly dependent upon the way that the Finder's in-built QuickLook plugin works. You may need to just implement one of those yourself.
Debugging these kinds of issues can be a little tricky, because you need to make sure macOS has assimilated your NSExportableTypes. One quick check is to drop into Terminal and use mdls <file of your type and extension> and see what the kMDItemContentType and kMDItemContentTypeTree are for your file.
If it's not recognizing the extension at all, make sure it's been re-loaded by using lsregister which is hidden away in the LaunchServices Framework of CoreServices.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister to get the man page
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -lint -f <path> to force reload of your application (the -lint) adds more detail on errors while interpreting the entries.
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -seed will reset the daemon and re-seed the data from the default applications and library locations.
I created bash file which constantly compiles the my latex file, the problem is though that the PDFviewer in texmaker doesn't update, eventhoug the raw PDF file is updated. How come is does the PDFviewer keep showing the old PDF until i use Texmaker to compile the texmaker?... I want the embedded PDFviewer in texmaker to update, the PDF it shows even though i don't use texmaker to compile the .tex file.
The bash file.
#!/bin/bash
while true
do
pdflatex -synctex=1 -interaction=nonstopmode /Users/Johnathan/Documents/Bachelor/Rp/bachelor.tex
sleep 4
done
I know this question is old, but I just had the same problem and found a solution for some Mac Users at least:
The short explanation: since El Capitan, there is no /usr/ directory anymore, but this is where Texmaker looks for latex.
In Texmaker -> Preferences -> Commands, substitute every /usr/ expression with /Library/TeX/, which is where Latex is installed.
This document holds all the details.
https://tug.org/mactex/UpdatingForElCapitan.pdf
Cheers
I think that the problem is not about your script(It works for me), I think is about your PDF viewer.
1)Try using Evince as a PDF reader, it will update your pdf automatically.
It has versions for Windows and Linux, and it is free.
https://wiki.gnome.org/Apps/Evince/Downloads
2)Another way is using your web browser (I have used Mozilla) as a PDF reader, writing in the URL bar:
file:///Users/Johnathan/Documents/Bachelor/Rp/bachelor.pdf
but this second way has the problem that you must refresh your web browser by yourself.
I hope that helps you!
I had the same problem of the PDF viewer not updating. The fix was:
Select: texmaker, preferences, commands, PDF viewer
Select: external viewer
Then pick adobe reader or whatever app you use to view pdf files with.
Then you bypass the pdf viewer in textmaker altogether.
Maks
Visit https://i.stack.imgur.com/np55x.png!
Make sure you choose the Quick Build and View PDF in the toolbar.
I am building a Delphi application which opens an image and its metadata and prints it. For the Windows version I build a form to generate the PrintPreview, but in Mac I can use the Print Dialog's 'Open PDF in Preview' instead. When I click on it, a PDF file is generated and I can see it, its OK. The problem is I want to access this option directly from a button, so when the button is clicked, the PDF in Preview is opened and the user does not have to open the Print Dialog, then click the 'PDF' and then select 'Open PDF in Preview'. How can I do this?
I read about using Automator, apple scripts etc, but I still can't find it.
Is there any path this generated PDF Preview is stored, so maybe I can open it from there?...
TIA
Possible duplicate of Using Automator or Applescript or both to recursively print documents to PDF but I'll answer anyways.
To answer your question directly see the question I linked to. Basically you need to use System Events from applescript to accomplish that exactly
However, there's a quicker solution using /usr/sbin/cupsfilter. Check the man page for more.
You can call cupsfilter <an-image-file> and you'll get a PDF on stdout, courtesy of OSX's printing daemon. It looks quite configurable but I just learned about it a while ago.
If you want this to open for the user you can save it in a nice place or you can do it the one-shot way and do cupsfilter <your-image> | open -f -a "Preview" to open the PDF right up.
I will be writing code that takes a screenshot, crops to a small section of the screen (predefined area of screen), and then extracts the text from that cropped image (via OCR tools), and then saves the resulting text to a file. I was wondering if there is software (preferably for Windows) that can do this, or at least parts of it. I am already looking into tesseract as an OCR tool. Anyone know of software that can take the screenshot, and possibly crop a predefined region of the image.
Thanks,
-Jason
I use Greenshot, which is a very awesome tool for screenshots and according to the FAQ it supports OCR (using MODI = Microsoft Office Document Imaging) as well. However, I never got it working on my Windows machine and used Tesseract instead (for Linux, with some scripting experience, this method should be possible as well):
Download Tesseract here for Ubuntu/Debian/Windows and install it.
Download and install Greenshot
Create a new windows batch script called "Greenshot_Tesseract_OCR.bat" using a text editor like notepad or Notepad++ - and save it at a location of your choice, e.g. "C:\Users\MyUser\Scripts\Greenshot_Tesseract_OCR.bat" - with the following content (depending on the installation location of tesseract):
ECHO OFF
set arg1=%1
"C:\Program Files\Tesseract-OCR\tesseract.exe" "%arg1%" "%arg1%"
type "%arg1%.txt" | clip
Right-click the Greenshot icon in the toolbar and click "configure external command"
Add a new command with a name like "Tesseract OCR to Clipboard", select the batch script you just created as a command and as argument, use the default "{0}". Then click OK twice.
You should now be able to copy the text of a screenshot into your clipboard, with a shortcut ("Print" key in my case) and 1-2 mouse clicks (depending on your Greenshot settings)!
You can try the following open-source programs:
Greenshot for screenshots and VietOCR (a GUI frontend for Tesseract) for OCR on screenshots.