ANNOUNCE: Cocoa Scripting Course #6, PDFKit

I wrote a new e-book about PDFKit Scripting. PDF 560 pages (In Japanese).

This book is the sixth installment of COCOA Scripting book. This is a pdfkit scripting commentary for those who want to perform PDF processing with AppleScript.

PDF processing is one valuable point of Cocoa scripting. It can be said that this process has been struggling with Cocoa calling. Cocoa Scripting has a as many as the number of stars, such as machine learning, REST API call, and high -speed data extraction from array, but PDF processing is definitely one of the top ranking targets.

With Scripter, which handles PDFs on a daily basis, you will definitely feel that the benefits of Cocoa scripting are enormous.

Table Of Contents:

Chapter 1 Introduction

Overview of Cocoa Scripting
What is cocoa scripting?
Cocoa scripting actual
The power of cocoa scripting
Advantages of COCOA Scripting
What is required for cocoa scripting
Cocoa scripting summary
Cocoa Scripting 9 oaths
About macOS suitable for cocoa scripting
Cocoa Scripting Environmental Evolution History
Cocoa Scriptable macOS
Reference Materials: Applescript Runime Environmental Information
Cocoa scripting different behavior
Come to SIP release
Programming style
Different development and execution environment
Difference in processing procedure
Scripting of functions that require main thread execution
Delegation, Notification
Rewrite due to differences in execution style
When you call a cocoa object with AppleScript …
Subroutine description
My and Me indicating the object hierarchy
Class expansion
To write fast Cocoa Script
Interaction with application
Implanted type conversion
Requisition is required for some commands
Fixed parentheses indicating the priority of calculation
How to count objects
How to check the information
How to investigate when performing Cocoa scripting
Apple online documents
“Open quickly” the header file with Xcode
How to walk a header file
Header file components
If you encounter a deprecated function
Enum (constant) description pattern
ENUM (constant) exceeding the numerical expression range of AppleScript

Chapter 2 Practice

Actually move cocoa script
Start Script Editor/Script Debugger
Execute Cocoa Script
Display Cocoa Object log
Save Cocoa Script documents
Cocoa Script export format
Translate the Cocoa calling description of Objective-C into AppleScript description
Configuration of Cocoa Script (AppleScriptobjc)
Various data notation of Objective-C (1/3)
Various data notation of Objective-C (2/3)
Various data notation of Objective-C (3/3)
Cocoa Method name specification
Cocoa method name conversion (1/3)
Cocoa method name conversion (2/3)
Cocoa method name conversion (3/3)
Basic COCOA object explanation
Parameters at the time of method calls
Nsstring (string)
NSARRAY (array)
NSDICTIONARY (dictionary)
Number (numbers)
ENUM (constant)
nil
Nsobject
Characteristic movement of COCOA Scripting
Between AppleScript and cocoa
Object conversion
Cocoa class corresponding to AppleScript objects
Arrangement related COCOA class
Record -related COCOA class
Cocoa class related to string
Date -related COCOA class
File Path related objects
File Path related object conversion method
Image -related cocoa object
File path string (NSSTRING) Related (1/2)
File path string (NSSTRING) Related (2/2)
URL related
Remote URL string related (1/2)
Remote URL string related (2/2)
Local File URL character string related
Arrangement -related
Dictionary related
NSSTRING character encoding related
COLOR related
HTML related
Cocoa Object conversion and generation
NSData
STYLED STRING (1/2)
STYLED STRING (2/2)
2D coordinate data
1D coordinate system data
Language, Locale -based data
Useful COCOA object (excerpt)

Chapter 3 PDFKit Basic

Position and role of PDFKIT
Know the framework by purpose
Main class in PDFKIT
The highlight of pdfkit+AppleScript
Points to note about pdfkit+AppleScript (1/2)
Points to note about pdfkit+AppleScript (2/2)
Declaration of use of pdfkit.framework
(Reference material) PDF coordinate system

PDFDocument Basic Samples

initWithURL:①
documentURL
majorVersion
minorVersion
string
documentAttributes
isEncrypted
isLocked
unlockWithPassword:①
permissionsStatus
allowsCopying
allowsPrinting
allowsCommenting
allowsContentAccessibility
allowsDocumentAssembly
allowsDocumentChanges
allowsFormFieldEntry
pageCount
pageAtIndex:①
indexForPage:①
insertPage:① atIndex:②
removePageAtIndex:①
exchangePageAtIndex:① withPageAtIndex:②
writeToFile:①
writeToFile:① withOptions:②
writeToURL:①
writeToURL:① withOptions:②

PDFPage Basic Samples

initWithImage:①
initWithImage:① options:②
document
label
rotation
annotations
displaysAnnotations
addAnnotation:①
removeAnnotation:①
numberOfCharacters
string
attributedString
characterBoundsAtIndex:①
dataRepresentation

PDFOutline Basic Samples
init
document
numberOfChildren
parent
index
label
destination
insertChild:① atIndex:②(1/2)
insertChild:① atIndex:②(2/2)
removeFromParent

PDFAnnotation Basic Samples

initWithBounds:① forType:② withProperties:③
page
modificationDate
userName
type
action
shouldDisplay
shouldPrint
annotationKeyValues
valueForAnnotationKey:①
setValue:① forAnnotationKey:②
removeValueForAnnotationKey:①
alignment
alignment(NSTextAlignment)
bounds
contents
font
fontColor
border
color
hasAppearanceStream
interiorColor
startPoint
endPoint
startLineStyle
endLineStyle
lineStyleFromName:①
nameForLineStyle:①
destination
URL
iconType
widgetFieldType
widgetStringValue
widgetDefaultStringValue
fieldName
backgroundColor
readOnly
multiline
isPasswordField
maximumLength
comb
widgetControlType
buttonWidgetState
buttonWidgetStateString
caption
allowsToggleToOff
radiosInUnison
choices
values
paths
stampName

Chapter 4 PDF processing basic edition

Flow of PDF processing

Basic processing often used in AppleScript + PDFKIT
Basic processing procedures often used in AppleScript + pdfkit

Information acquisition from PDF

Get PDF size by POINT
Acquire various information from PDF by nsdictionary
Acquire various information from PDF by character string

PDF page count

PDF page count (PDFDOCUMENT)
PDF page count (via Metadata Lib)

PDF text text extraction

Extract the text of all PDF pages
Extract PDF texts on pages

Rotate PDF

Rotate PDF and save new

Print PDF

Print PDF

Convert RTF to PDF

Convert RTF to PDF (1/3)
Convert RTF to PDF (2/3)
Convert RTF to PDF (3/3)

Text search from PDF

Specified keyword search from PDF text

PDF division on page units

PDF division on page by page (1/2)
PDF division on page by page (2/2)

Multiple PDF bond

Combine multiple PDFs selected by the Choose File command

PDF → Other type image conversion

Convert to JPEG image on a page basis (1/2)
Convert to JPEG image on a page basis (2/2)

Create PDF by connecting images

Connect the JPEG image in the folder into the new PDF
Connect all images under the specified folder into the new PDF
Connect the JPEG image in the folder into the existing PDF

Multi Page Tift to PDF

Conversion from Multi Page Tiff to PDF (1/2)
Conversion from Multi Page Tiff to PDF (2/2)

Display PDF in the alert dialog

Display PDF in alert dialog + WkWebView
Display PDF in alert dialog + PDFView

Chapter 5 PDF processing advanced edition

PDF password, encryption settings

PDF access rights and passwords
Check password settings
Get the set permissions
Set a password for PDF (1/2)
Set a password for PDF (2/2)
Unlock PDF password

PDF blank page detection

Delete a blank page from PDF (1/3)
Delete a blank page from PDF (2/3)
Delete a blank page from PDF (3/3)

PDF form input

Enter the text in the PDF form and save another name (1/2)
Enter the text in the PDF form and save another name (2/2)
Check box input to PDF form (1/2)
Check box input to PDF form (2/2)

Quartz filter

What is Quartz filter?
Quartzfilter output example list
Output a list of Quartz filters
Output with a black and white Quartz filter
Output with a Blue Tone Quartz filter
Output with the Quartz filter of PDFX-3
Output by applying a gray tone Quartz filter
Output by applying a quartz filter with a decrease in brightness
Output by applying a quartz filter with an increase in brightness
Output by applying a quartz filter with a reduced file size
Output by applying a Quartz filter of Sepia Tone

Get, add, rewrite, delete PDF annotation

About annotation
Get annotation
Added circle annotation
Added Square annotation
Added line annotation
Added text annotation
Added URL link annotation (1/2)
Added URL link annotation (2/2)
Add highlights to the designated language group (1/2)
Add highlights to the designated language group (2/2)
Add an underline to the designated language group (1/2)
Add an underline to the designated language group (2/2)
Added a cancellation line to the designated word group (1/2)
Added a cancellation line to the designated word group (2/2)
Delete all annotations from PDF

Link extraction of PDF, link replacement

What is the link to PDF?
Get various information about links (1/2)
Get various information on links (2/2)
Extract URL from link annotation
Added URL link annotation (1/2)
Added URL link annotation (2/2)
Added link annotation in documents (1/2)
Added link annotation in documents (2/2)
Replace the URL of link annotation

OCR processing of PDF (OCR text embedded)

PDF OCR processing (1/3)
PDF OCR processing (2/3)
PDF OCR processing (3/3)

Acquired, added, deleted PDF bookmarks (TOC)

The title of the TOC and the hierarchy are annoying (1/2)
The title of TOC and the hierarchy are troublesome (2/2)
Get the TOC of the specified PDF and record it (1/2)
Get the TOC of the specified PDF and record it (2/2)
Added a flat TOC with only a non -albid (1/2)
Added a flat TOC only (2/2)
Add hierarchy toc from Record data (1/3)
Add hierarchy toc from Record data (2/3)
Add hierarchy toc from Record data (3/3)
Add hierarchy toc from Numbers table data (1/4)
Add hierarchy toc from Numbers table data (2/4)
Add hierarchy toc from Numbers table data (3/4)
Add hierarchy toc from the table data of NUMBERS (4/4)
Delete TOC of the specified PDF

Attached sample Script introduction

Sample Script collection

Materials

1 Like