Acrobat Preflight

[Acrobat]プリフライト実行 ファイルをコピーしてから実行する(オリジナルを保持する)


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003# プリフライトの実行
004(*
005プリフライトは、別名で保存されずに上書きされるので
006前面のPDFドキュメントを複製してから
007複製したコピーに対して
008選択したプリフライトを適応します。
009
010FIXUP 修正を入れるプリフライト専用です
011
012*)
013#com.cocolog-nifty.quicktimer.icefloe
014----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
015use AppleScript version "2.8"
016use framework "Foundation"
017use framework "AppKit"
018use scripting additions
019property refMe : a reference to current application
020
021#####################
022#前面ウィンドウチェック
023tell application "Adobe Acrobat"
024  ###ウィンドウの数
025  set numCntWin to (count of PDF Window) as integer
026end tell
027if numCntWin = 0 then
028  log "ウィンドウがありません"
029  ###ダイアログ
030  set strName to (name of current application) as text
031  if strName is "osascript" then
032    tell application "Finder" to activate
033  else
034    tell current application to activate
035  end if
036  display alert "エラー:pdfを開いていません" buttons {"OK", "キャンセル"} default button "OK" as informational giving up after 3
037  return "ウィンドウがありませんPDFを開いてね"
038end if
039#####################
040#前面PDFのファイルパス
041tell application "Adobe Acrobat"
042  activate
043  tell active doc
044    set aliasFilePath to file alias as alias
045  end tell
046end tell
047##パス
048set strFilePath to (POSIX path of aliasFilePath) as text
049set ocidFilePathStr to refMe's NSString's stringWithString:(strFilePath)
050set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
051set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
052#拡張子をとって
053set ocidBaseFilePathURL to ocidFilePathURL's URLByDeletingPathExtension()
054set ocidBaseFileName to ocidBaseFilePathURL's lastPathComponent()
055set ocidDistFilePathURL to ocidBaseFilePathURL's URLByAppendingPathExtension:("プリフライト済.pdf")
056
057##中間ファイル
058set appFileManager to refMe's NSFileManager's defaultManager()
059set ocidTempDirURL to appFileManager's temporaryDirectory()
060set ocidUUID to refMe's NSUUID's alloc()'s init()
061set ocidUUIDString to ocidUUID's UUIDString
062set ocidSaveDirPathURL to ocidTempDirURL's URLByAppendingPathComponent:(ocidUUIDString) isDirectory:true
063set ocidAttrDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
064ocidAttrDict's setValue:(511) forKey:(refMe's NSFilePosixPermissions)
065set listBoolMakeDir to appFileManager's createDirectoryAtURL:(ocidSaveDirPathURL) withIntermediateDirectories:true attributes:(ocidAttrDict) |error| :(reference)
066set ocidSaveBaseFilePathURL to ocidSaveDirPathURL's URLByAppendingPathComponent:(ocidBaseFileName) isDirectory:(false)
067set ocidSaveFilePathURL to ocidSaveBaseFilePathURL's URLByAppendingPathExtension:("プリフライト済.pdf")
068set strSaveFileName to ocidSaveFilePathURL's lastPathComponent() as text
069#コピー
070set appFileManager to refMe's NSFileManager's defaultManager()
071set ListDone to (appFileManager's copyItemAtURL:(ocidFilePathURL) toURL:(ocidSaveFilePathURL) |error| :(reference))
072set aliasSaveFilePath to (ocidSaveFilePathURL's absoluteURL()) as alias
073
074########################
075#プリフライトの数
076tell application "Adobe Acrobat"
077  do script ("var numPreflight = Preflight.getNumProfiles(app.thermometer); ")
078  set numCntPreflight to do script ("Preflight.getNumProfiles(app.thermometer); ")
079  log "Preflight:" & numCntPreflight
080end tell
081
082########################
083#プリフライト名の収集
084set listPreflightName to {} as list
085repeat with itemNo from 0 to (numCntPreflight - 1) by 1
086  tell application "Adobe Acrobat"
087    do script ("Preflight.getNthProfile(" & itemNo & ").name;")
088    set strListItem to (do script ("Preflight.getNthProfile(" & itemNo & ").name;")) as text
089  end tell
090  copy strListItem to end of listPreflightName
091end repeat
092########################
093#ソートしておく
094set ocidPreflightNameArray to refMe's NSArray's arrayWithArray:(listPreflightName)
095set ocidSortedArray to ocidPreflightNameArray's sortedArrayUsingSelector:("localizedStandardCompare:")
096#ダイアログ用にリスト化して
097set listPreflight to ocidSortedArray as list
098
099########################
100#ダイアログ
101set strName to (name of current application) as text
102if strName is "osascript" then
103  tell application "Finder" to activate
104else
105  tell current application to activate
106end if
107try
108  set listResponse to (choose from list listPreflight with title "プリフライトリスト" with prompt "プリフライトのリスト" default items (item 5 of listPreflight) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
109on error
110  log "エラーしました"
111  return
112end try
113if (item 1 of listResponse) is false then
114  return
115end if
116##選んだプロファイル名
117set strResponse to (item 1 of listResponse) as text
118
119########################
120#コピーしたファイルを開く
121tell application "Adobe Acrobat"
122  activate
123  set objActivDoc to open aliasSaveFilePath
124end tell
125#ファイルが開き終わるのを待つ
126repeat 10 times
127  tell application "Adobe Acrobat"
128    activate
129    tell front PDF Window
130      set strWindowName to name as text
131    end tell
132    if strWindowName is strSaveFileName then
133      exit repeat
134    else
135      delay 0.25
136    end if
137  end tell
138  
139end repeat
140
141########################
142#プロファイル実行
143tell application "Adobe Acrobat"
144  do script ("var appProfile = Preflight.getProfileByName(\"" & strResponse & "\");")
145  do script ("var appThermometer = app.thermometer;")
146  do script ("this.preflight( appProfile,false, appThermometer);")
147end tell
148
149
150########################
151# PDFX等はファイル名にsufixを付与するため
152#実行後のパスを取得
153tell application "Adobe Acrobat"
154  tell active doc
155    set aliasPDFXFilePath to file alias as alias
156  end tell
157end tell
158
159########################
160#前面ドキュメントを閉じる
161tell application "Adobe Acrobat"
162  try
163    tell document strSaveFileName
164      close saving no
165    end tell
166  on error
167    tell active doc
168      close saving no
169    end tell
170  end try
171end tell
172
173########################
174#変更後のパスを再取得して
175set strSaveFilePath to (POSIX path of aliasPDFXFilePath) as text
176set ocidSaveFilePathStr to refMe's NSString's stringWithString:(strSaveFilePath)
177set ocidSaveFilePath to ocidSaveFilePathStr's stringByStandardizingPath()
178set ocidSaveFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidSaveFilePath) isDirectory:false)
179
180########################
181#ファイルを移動
182set ListDone to (appFileManager's moveItemAtURL:(ocidSaveFilePathURL) toURL:(ocidDistFilePathURL) |error| :(reference))
183if (item 1 of ListDone) is false then
184  set strName to (name of current application) as text
185  if strName is "osascript" then
186    tell application "Finder" to activate
187  else
188    tell current application to activate
189  end if
190  display alert "同名のファイルがあるので中止しました" buttons {"OK", "キャンセル"} default button "OK" as informational giving up after 3
191  return "同名のファイルがあるので中止しました"
192end if
193set aliasDistFilePath to (ocidDistFilePathURL's absoluteURL()) as alias
194
195########################
196#プリフライト済みのファイルを開く
197tell application "Adobe Acrobat"
198  activate
199  set objActivDoc to open aliasDistFilePath
200end tell
201
202return "処理終了"
AppleScriptで生成しました

|

[Preflight]エラー『ユーザー独自の環境設定をコピーできません』の解決方法(Windows)



macOSの場合はこちら
[Preflight]エラー『ユーザー独自の環境設定をコピーできません』の解決方法


202412090621051_670x306
重要
手順の中で
デスクトップに移動するプリフライトフォルダには
ご自分でカスタマイズした設定等が入っています
間違えてゴミ箱に入れたりしないようにしてください
手順
1:Acrobat起動
2:セキュリティ(拡張)設定変更
3:Javascript設定変更
4:Acrobat終了
ーーー
5:既存の『Preflight Acrobat XXXXXXXX』フォルダをデスクトップに移動
ーーー
6:Acrobat起動
7:プリフライト実行

手順7でエラーになる場合
もう一度
手順1から6までを実施
8:Javascriptコンソール(デバッガーを起動)
9:コマンド実行
10:プリフライト実行

プリフライトが起動出来たら
手順5でデスクトップに移動したフォルダ内から必要な設定があれば
再度読み込んで再登録


1:Acrobat起動
普通に起動してください


2:セキュリティ(拡張)設定変更
202412090621451_2262x1750_20241209185701


3:Javascript設定変更
202412090621452_2262x1750


4:Acrobat終了
ここ重要です。必ずAcrobatを一度終了させてください


5:既存の『Preflight Acrobat XXXXXXXX』フォルダをデスクトップに移動
保護モードが有効になっていると
プリフライトの初期化の前にプリフライトフォルダが出来ちゃうのが原因ですね
対象のフォルダのパスは
"C:\Users\ユーザー名\AppData\Roaming\Adobe\Acrobat\Preflight Acrobat Continuous"

5−1:"C:\Users\ユーザー名\AppData\Roaming\Adobe\Acrobat\"に移動します
202412090622472_1230x372

5−2:Preflight Acrobat XXXXXフォルダをでくストップに移動
XXXXXにはContinuous DC 2020 Classicのどれかの文字が入ります
なので
202412090623051_1586x368


7:プリフライト実行

8:Javascriptコンソール(デバッガーを起動)
5db106dfaeae42bfbd1766b7cd71ff03

ダウンロード - openconsole.pdf.zip


9:コマンド実行
サンプルコード

サンプルソース(参考)
行番号ソース
001Preflight.getNumProfiles(app.thermometer);
AppleScriptで生成しました
202412050600142_1170x1118

202412050556211_2322x1750

重要
デスクトップに移動したプリフライトフォルダには
今まで使っていた設定等が入っています
そのため
個別でカスタマイズした設定を使っている方は
再度読み込みなおす必要があります。
ゴミ箱に入れたりしないようにしてください



|

[Preflight]エラー『ユーザー独自の環境設定をコピーできません』の解決方法



Windowsの場合の手順はこちら
[Preflight]エラー『ユーザー独自の環境設定をコピーできません』の解決方法(Windows)


AcrobatのPreflight(プリフライト)で
初期化に失敗するケースの対処方法

202412050513221_536x234

原因
保護モード(サンドボックス)の不具合
Acroabat V24002以降で発生する『ケースがある』Acroabat側の不具合なので、お使いのOSや他のユーザー設定とは関係ないので安心してください
Acrobatのプリフライトツールは
Adobeの独自開発した製品ではなく
他社製品(callas pdfToolbox)の組み込みプラグインなので
Acrobatの開発チームの影響範囲の見落としと思われます

サンドボックスモードでファイルのコピーを行えない場所に
app.thermometer=プリフライトの『元』ファイルがあるので
Acrobatが設定ファイルをコピー・生成できない


Macの場合で保護モードを使っている場合は
さらに少し複雑で
『ファイルのアクセス権」の問題で失敗するケースもありますので
プリフライトの『初期化時だけ』は保護モードをOFFにしましょう
(初期化出来たら、保護モードに戻しても大丈夫です)


対応方法
プリフライトの初回初期化時『だけ』は保護モードをOFFにする


プリフライトの初回初期化時に
『起動時に保護モードを有効にする』

『拡張セキュリティ』

OFFにして初期化する。
(1回初期化に成功すればバージョンアップまでは不具合なく使える『はず』)
初期化に成功すればセキュリティ設定はONに戻しても大丈夫

手順
1:Acrobat起動 メニュー>>環境設定>>セキュリティ(拡張)を開く
2:起動時に保護モードを有効にする(M)をOFFにする
3:拡張セキュリティをOFFにする
4:Acrobat起動 メニュー>>環境設定>>JavaScriptを開く
5:JavaScript設定を有効にする
6:Acrobatを終了
7:Acrobat起動
-->通常ならここまで設定すれば次回プリフライト実行時に必要なファイルがコピーされて初期化されます
8:コンソール(デバッガーを開く)
9:コマンドペーストして実行
10:動作確認

1:Acrobat起動 メニュー>>環境設定>>セキュリティ(拡張)を開く
2:起動時に保護モードを有効にする(M)をOFFにする
3:拡張セキュリティをOFFにする
202412050553051_1844x694
4:Acrobat起動 メニュー>>環境設定>>JavaScriptを開く
5:JavaScript設定を有効にする
202412050544011_1704x1074_20241205175501
6:Acrobatを終了
7:Acrobat起動

-->通常ならここまで設定すれば次回プリフライト実行時に必要なファイルがコピーされて初期化されます

初期化を自分で明示的に行いたい場合は
この後の8と9を実施してください



8:コンソール(デバッガーを開く)

ダウンロード - openconsole.pdf.zip



9:コマンドペーストして実行
サンプルコード

サンプルソース(参考)
行番号ソース
001Preflight.getNumProfiles(app.thermometer);
AppleScriptで生成しました
202412050600142_1170x1118

202412050556211_2322x1750

10:動作確認
初期化に成功していれば
拡張セキュリティと保護モードを有効に戻しても大丈夫です
次回アップデート等のタイミングで発生したら
同じ処理をするようにします

|

DS(デジタルセンド)

http://www.digital-send.com/
プリフライト・パッケージ
https://dsw.digital-send.com/chkpage/downloads/Package_DSW_Checker_Installer_Mac.zip


アプレットは
スクリプトエディタで開き
上書き保存すれば継続利用可能

|

callas pdfToolbox 15.2 アップデート

202411220209221_1170x574
202411220219171_1272x474

|

[Acrobat]プリフライト『規格マッチ』の実行(仮)



ダウンロード - チェックPDF.zip




AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#!/usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003# javascriptを実行する
004#  javasript UTF8用
005(*
006■PDF/X(印刷用規格)
007PDF/X-1a:2001: CMYKおよびスポットカラーのみ対応、RGBや透明効果は不可。
008PDF/X-1a:2003: 2001版の改良版。ファイル構造の改善。
009PDF/X-3:2002: CMYK、RGB、ICCプロファイルをサポート。RGBカラー使用可能。
010PDF/X-3:2003: 2002版の改良版。色管理に対応する印刷用途向け。
011PDF/X-4:2008: 透明効果とレイヤーをサポート。ライブ透明やICCプロファイル対応。
012PDF/X-4:2010: 2008版の改良版。透過効果など最新技術に対応。
013PDF/X-4p:2008: プロファイルが外部参照できる形式で、透明効果をサポート。
014PDF/X-4p:2010: 2008版の改良版。外部プロファイルの利用に対応。
015PDF/X-5g:2008: グラフィックデザイン向け、外部グラフィックを参照できる。
016PDF/X-5n:2008: デバイス非依存の色空間をサポート(CMYK以外の色空間対応)。
017PDF/X-5pg:2008: 外部参照グラフィックとプロファイルに対応。
018PDF/X-6:2020: 最新の印刷業界向け標準、現代的なプロファイルと機能に対応。
019PDF/X-6p:2020: プロファイル外部参照が可能、最新印刷技術対応。
020PDF/X-6n:2020: 非デバイス依存の色空間に対応した最新規格。
021■PDF/A(アーカイブ用規格)
022PDF/A-1a:2005: 長期保存向け、全文検索可能で、全てのフォント埋め込みが必要。
023PDF/A-1b:2005: PDF/A-1aの簡易版。視覚的忠実性のみを保証。
024PDF/A-2a:2010: 透過、レイヤー、JPEG2000をサポート。完全な構造情報保持。
025PDF/A-2b:2010: PDF/A-2aの簡易版。視覚的忠実性のみを保証。
026PDF/A-2u:2010: Unicodeをサポートし、文字情報をより豊かに保持。
027PDF/A-4:2020: PDF 2.0に基づき、最新のアーカイブ規格。モダンな機能に対応。
028PDF/A-4f:2020: 外部ファイル添付が可能なPDF/A-4の拡張版。
029PDF/A-4e:2020: エンジニアリング向けの拡張、外部CADファイル添付に対応。
030■PDF/E(エンジニアリング向け規格)
031PDF/E-1:2008: エンジニアリングおよび建築分野向け。3Dデータやアノテーションに対応。
032■PDF/VT(バリアブル印刷向け規格)
033PDF/VT-1:2010: 可変データ印刷向けのPDF規格。大規模データ印刷に対応。
034PDF/VT-2:2010: PDF/VT-1の改良版。データ最適化に対応。
035PDF/VT-3:2020: 最新バージョン、可変データと固定データを効率的に管理。
036
037Javascriptを外部ファイルにしています
038こちらをダウンロードして試してください
039https://quicktimer.cocolog-nifty.com/icefloe/files/e38381e382a7e38383e382afpdf.zip
040*)
041#com.cocolog-nifty.quicktimer.icefloe
042----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
043use AppleScript version "2.8"
044use framework "Foundation"
045use framework "AppKit"
046use scripting additions
047property refMe : a reference to current application
048
049set ocidTextEnc to (refMe's NSUTF8StringEncoding)
050
051#######
052set aliasPathToMe to (path to me) as alias
053set strPathToMe to (POSIX path of aliasPathToMe) as text
054set ocidFilePathStr to refMe's NSString's stringWithString:(strPathToMe)
055set ocidFilePath to ocidFilePathStr's stringByStandardizingPath()
056set ocidFilePathURL to (refMe's NSURL's alloc()'s initFileURLWithPath:(ocidFilePath) isDirectory:false)
057#
058set ocidConteinerDirPathURL to ocidFilePathURL's URLByDeletingLastPathComponent()
059
060set ocidJsDirPathURL to ocidConteinerDirPathURL's URLByAppendingPathComponent:("js") isDirectory:(true)
061###コンテンツを収集する 第一階層のみ
062set appFileManager to refMe's NSFileManager's defaultManager()
063##不可視ファイルを除く
064set ocidOption to (refMe's NSDirectoryEnumerationSkipsHiddenFiles)
065set listKey to {(refMe's NSURLPathKey), (refMe's NSURLNameKey)} as list
066##パスURLとファイル名を収集
067set ocidForKey to refMe's NSArray's alloc()'s initWithArray:(listKey)
068set listResponse to appFileManager's contentsOfDirectoryAtURL:(ocidJsDirPathURL) includingPropertiesForKeys:{ocidForKey} options:(ocidOption) |error| :(reference)
069if (item 2 of listResponse) = (missing value) then
070  log "正常処理"
071  set ocidFilePathURLArray to (item 1 of listResponse)
072else if (item 2 of listResponse) ≠ (missing value) then
073  set strErrorNO to (item 2 of listResponse)'s code() as text
074  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
075  refMe's NSLog("■:" & strErrorNO & strErrorMes)
076  return "エラーしました" & strErrorNO & strErrorMes
077end if
078##
079set ocidFileNameDict to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
080repeat with itemFilePathURL in ocidFilePathURLArray
081  set ocidFileName to itemFilePathURL's lastPathComponent()
082  (ocidFileNameDict's setValue:(itemFilePathURL) forKey:(ocidFileName))
083end repeat
084set listFileName to (ocidFileNameDict's allKeys()) as list
085###ダイアログを前面に出す
086tell current application
087  set strName to name as text
088end tell
089if strName is "osascript" then
090  tell application "Finder" to activate
091else
092  tell current application to activate
093end if
094try
095  set listResponse to (choose from list listFileName with title "選んでください" with prompt "実行するプログラムは?選んでください" default items (item 1 of listFileName) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
096on error
097  log "エラーしました"
098  return "エラーしました"
099end try
100if (item 1 of listResponse) is false then
101  return "キャンセルしました"
102end if
103###ダイアログの戻り値
104set strFileName to (item 1 of listResponse) as text
105###レコードから取り出す
106set ocidJsFilePathURL to ocidFileNameDict's valueForKey:(strFileName)
107
108#######
109set ocidOption to (refMe's NSDataReadingMappedIfSafe)
110set listResponse to refMe's NSData's alloc()'s initWithContentsOfURL:(ocidJsFilePathURL) options:(ocidOption) |error| :(reference)
111if (item 2 of listResponse) = (missing value) then
112  set ocidReadData to (item 1 of listResponse)
113else if (item 2 of listResponse) ≠ (missing value) then
114  set strErrorNO to (item 2 of listResponse)'s code() as text
115  set strErrorMes to (item 2 of listResponse)'s localizedDescription() as text
116  refMe's NSLog("■:" & strErrorNO & strErrorMes)
117  return "エラーしました" & strErrorNO & strErrorMes
118end if
119#######
120set listPDFCompliance to {"PDF/X-1a:2001", "PDF/X-1a:2003", "PDF/X-3:2002", "PDF/X-3:2003", "PDF/X-4:2008", "PDF/X-4:2010", "PDF/X-4p:2008", "PDF/X-4p:2010", "PDF/X-5g:2008", "PDF/X-5n:2008", "PDF/X-5pg:2008", "PDF/X-6:2020", "PDF/X-6p:2020", "PDF/X-6n:2020", "PDF/A-1a:2005", "PDF/A-1b:2005", "PDF/A-2a:2010", "PDF/A-2b:2010", "PDF/A-2u:2010", "PDF/A-4:2020", "PDF/A-4f:2020", "PDF/A-4e:2020", "PDF/E-1:2008", "PDF/VT-1:2010", "PDF/VT-2:2010", "PDF/VT-3:2020"} as list
121#エラーコードはcallas pdfToolboxのもの
122set recordErrorCodeEn to {|0|:"No error (successful analysis)", |10|:"Unable to open config file for reading", |11|:"Unable to open pdf file for reading", |12|:"Unable to open json file for writing", |20|:"An unknown error has occurred", |21|:"Unable to write pdf file, file access error", |22|:"Undefined Mediabox, minimum page size should be 3 by 3 units", |23|:"An error has occurred in flate encoder", |24|:"An error has occurred in flate decoder", |25|:"An error has occurred in lzw decoder", |26|:"An error has occurred in ASCII-85 decoder", |27|:"An error has occurred in ASCII-Hex decoder", |28|:"An error has occurred in RunLength decoder", |29|:"An error has occurred in prediction decoder", |30|:"An error has occurred in dct (jpeg-image) decoder", |31|:"File offset is greater than 9999999999 bytes. PDF only allows offsets up to 10 decimal digits", |32|:"The required resource name is too large, too much resources are required", |33|:"A spot color space has no name or a wrong alternate color space type", |34|:"A path length entry is out of range", |35|:"There are too many PDF files open", |36|:"Unable to open the PDF file for import", |37|:"PDF file is not supported, it might be encrypted", |38|:"Unable to parse pdf file, syntax error found", |39|:"The page could not be found", |40|:"A given parameter is invalid or wrong", |41|:"The given object number is invalid", |42|:"A inline-image contains an ID without a BI", |43|:"A content stream contains illegal commands", |44|:"A resource could not be found", |45|:"A given resource is wrong", |46|:"A given function object is wrong", |47|:"Unable to read font resource", |48|:"Unable to find glyphs in current font", |49|:"An error has occured in XMP Metadata function", |50|:"Invalid context (e.g. a context is popped wich never was pushed)", |51|:"Page without underlay or overlay reservation", |52|:"The keycode you have entered is invalid", |53|:"The keycode you have entered has expired", |54|:"Unable to draw barcode", |55|:"Unable to open icc profile from file path", |56|:"Unable to read all required encryption parameter", |57|:"The page limit is exhausted", |58|:"Too many parallel processes", |59|:"The requested barcode is not supported", |60|:"Unable to read all linearized hint data", |61|:"There are too many colorants in a DeviceN color space, the limit is 32", |62|:"Unable to execute shared resource objects process", |63|:"Unable to open, read or write temporary file", |64|:"Unable to process a given png image file", |65|:"Unable to process a given gif image file", |66|:"The given file is empty", |67|:"File could not be identified as a PDF file", |68|:"The PDF file is encrypted and need a password to open", |100|:"Exception caught CCW Exceptions Message", |101|:"Unable to remove corrupt json file after fatal error occured", |110|:"Access violation caught Fatal error - abort", |113|:"Conversion did not finish during user specified timeout"} as record
123#エラーコードはcallas pdfToolboxのもの
124set recordErrorCodeJa to {|0|:"エラーなし(解析成功)", |10|:"設定ファイルを読み込めません", |11|:"PDFファイルを読み込めません", |12|:"JSONファイルを書き込めません", |20|:"不明なエラーが発生しました", |21|:"PDFファイルの書き込みに失敗しました(ファイルアクセスエラー)", |22|:"Mediaboxが定義されていません(最小ページサイズは3×3ユニット)", |23|:"Flateエンコーダでエラーが発生しました", |24|:"Flateデコーダでエラーが発生しました", |25|:"LZWデコーダでエラーが発生しました", |26|:"ASCII-85デコーダでエラーが発生しました", |27|:"ASCII-Hexデコーダでエラーが発生しました", |28|:"RunLengthデコーダでエラーが発生しました", |29|:"予測デコーダでエラーが発生しました", |30|:"DCT(JPEG画像)デコーダでエラーが発生しました", |31|:"ファイルのオフセットが10桁バイトを超えています", |32|:"必要なリソース名が大きすぎます(リソースが過剰です)", |33|:"スポットカラー空間に名前がないか、代替カラー空間の種類が間違っています", |34|:"パス長エントリが範囲外です", |35|:"PDFファイルが多すぎます(ファイルを開けません)", |36|:"PDFファイルのインポートに失敗しました", |37|:"PDFファイルはサポートされていません(暗号化されている可能性があります)", |38|:"PDFファイルの解析に失敗しました(構文エラー)", |39|:"ページが見つかりません", |40|:"与えられたパラメータが無効です", |41|:"与えられたオブジェクト番号が無効です", |42|:"インライン画像にBIなしでIDが含まれています", |43|:"コンテンツストリームに不正なコマンドがあります", |44|:"リソースが見つかりません", |45|:"指定されたリソースが間違っています", |46|:"指定された関数オブジェクトが間違っています", |47|:"フォントリソースを読み込めません", |48|:"現在のフォントでグリフが見つかりません", |49|:"XMPメタデータ機能でエラーが発生しました", |50|:"無効なコンテキスト(例えば、プッシュされていないコンテキストがポップされました)", |51|:"下敷きやオーバーレイ予約がないページ", |52|:"入力されたキーコードが無効です", |53|:"入力されたキーコードが期限切れです", |54|:"バーコードの描画に失敗しました", |55|:"ファイルパスからICCプロファイルを開けません", |56|:"必要な暗号化パラメータをすべて読み取れませんでした", |57|:"ページの上限に達しました", |58|:"並列プロセスが多すぎます", |59|:"要求されたバーコードはサポートされていません", |60|:"すべての線形化ヒントデータを読み取れませんでした", |61|:"DeviceNカラースペースのカラントが多すぎます(上限は32)", |62|:"共有リソースオブジェクトのプロセスを実行できません", |63|:"一時ファイルの読み書きに失敗しました", |64|:"指定されたPNG画像ファイルを処理できません", |65|:"指定されたGIF画像ファイルを処理できません", |66|:"指定されたファイルが空です", |67|:"PDFファイルとして認識できませんでした", |68|:"PDFファイルが暗号化されており、パスワードが必要です", |100|:"例外がキャッチされました CCW Exceptions Message", |101|:"致命的なエラー後、壊れたJSONファイルを削除できません", |110|:"アクセス違反がキャッチされました- 致命的なエラー中断", |113|:"ユーザー指定のタイムアウト内に変換が完了しませんでした"} as record
125#DICTにしておく
126set ocidErrorCodeDictJp to refMe's NSMutableDictionary's alloc()'s initWithCapacity:0
127ocidErrorCodeDictJp's setDictionary:(recordErrorCodeJa)
128set ocidAllKeys to ocidErrorCodeDictJp's allKeys()
129#ダイアログ
130tell current application
131  set strName to name as text
132end tell
133if strName is "osascript" then
134  tell application "Finder" to activate
135else
136  tell current application to activate
137end if
138try
139  set listResponse to (choose from list listPDFCompliance with title "選んでください" with prompt "選んでください" default items (item 1 of listPDFCompliance) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
140on error
141  log "エラーしました"
142  return "エラーしました"
143end try
144if (item 1 of listResponse) is false then
145  return "キャンセルしました"
146end if
147###ダイアログの戻り値
148set strComplianceName to (item 1 of listResponse) as text
149
150
151#######
152#読みこんだJavascriptファイルNSDATAをテキストに
153set ocidReadString to refMe's NSMutableString's alloc()'s initWithData:(ocidReadData) encoding:(ocidTextEnc)
154#置換して実行形式に
155set ocidComplianceName to (refMe's NSString's stringWithString:(strComplianceName))
156set ocidReplacedStrings to (ocidReadString's stringByReplacingOccurrencesOfString:("strPreFlightName") withString:(ocidComplianceName))
157#テキストにして実行
158set strReadString to ocidReplacedStrings as text
159
160tell application "Adobe Acrobat"
161  try
162    set strResponse to (do script strReadString) as text
163  on error
164    return "Js実行でエラーしました"
165  end try
166end tell
167#DICTを参照してエラーコード内容を取得
168set strErrorCode to (ocidErrorCodeDictJp's valueForKey:(strResponse)) as text
169#判定とログ
170if strResponse is "0" then
171  return strComplianceName & " : 規格に最適化されています: " & strResponse & " : " & strErrorCode
172else
173  log strComplianceName & " : エラーコード:" & strResponse & " : " & strErrorCode
174  return strComplianceName & " : 【NG】規格に最適化されていません : " & strResponse & " : " & strErrorCode
175end if
AppleScriptで生成しました

|

インストール済みのプリフライトのリストを取得する


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004#
005#com.cocolog-nifty.quicktimer.icefloe
006----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
007use AppleScript version "2.8"
008use framework "Foundation"
009use scripting additions
010property refMe : a reference to current application
011
012###プリフライトの数
013tell application "Adobe Acrobat"
014  do script ("var numPreflight = Preflight.getNumProfiles(app.thermometer); ")
015  set numPreflight to do script ("Preflight.getNumProfiles(app.thermometer); ")
016  log "Preflight:" & numPreflight
017end tell
018set numPreChk to 0
019###プリフライトのリスト
020repeat numPreflight times
021  tell application "Adobe Acrobat"
022    do script ("Preflight.getNthProfile(" & numPreChk & ").name;")
023    set strListItem to (do script ("Preflight.getNthProfile(" & numPreChk & ").name;"))
024  end tell
025  ##テキストにしていく
026  if numPreChk = 0 then
027    set strPreflightList to strListItem
028  else
029    set strPreflightList to strPreflightList & "\n" & strListItem
030  end if
031  set numPreChk to numPreChk + 1
032end repeat
033####NSStringに
034set ocidPreflightStr to refMe's NSString's stringWithString:(strPreflightList)
035#改行毎でArrayにして
036set ocidPreflightArray to ocidPreflightStr's componentsSeparatedByString:("\n")
037#ソートしておく
038set ocidSortedArray to ocidPreflightArray's sortedArrayUsingSelector:("localizedStandardCompare:")
039#ダイアログ用にリスト化して
040set listPreflight to ocidSortedArray as list
041###ダイアログ
042set strName to (name of current application) as text
043if strName is "osascript" then
044  tell application "Finder" to activate
045else
046  tell current application to activate
047end if
048try
049  set listResponse to (choose from list listPreflight with title "プリフライトリスト" with prompt "プリフライトのリスト" default items (item 5 of listPreflight) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
050on error
051  log "エラーしました"
052  return
053end try
054if (item 1 of listResponse) is false then
055  return
056end if
057##選んだプロファイル名
058set strResponse to (item 1 of listResponse) as text
059
AppleScriptで生成しました

|

[js]プロファイルの実行(単体)


サンプルコード

サンプルソース(参考)
行番号ソース
001#set strProfile to ("グレースケールに変換") as text
002set strProfile to ("文書が署名されているか確認") as text
003
004tell application id "com.adobe.Acrobat.Pro"
005  activate
006  tell active doc
007    do script "var objResponse = this.preflight(Preflight.getProfileByName(\"" & strProfile & "\"));"
008    #これでいいのか?
009    do script "objResponse.numErrors;"
010    do script "objResponse.numWarnings;"
011    do script "objResponse.numInfos;"
012    do script "objResponse.numFixed;"
013    do script "objResponse.numNotFixed;"
014  end tell
015end tell
016
AppleScriptで生成しました

|

[Acrobat]プリフライトを選んで実行


AppleScript サンプルコード

【スクリプトエディタで開く】 |

AppleScript サンプルソース(参考)
行番号ソース
001#! /usr/bin/env osascript
002----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
003#
004# プリフライトの画面は出ませんので ファイルの変換といったような
005# 眼に見える処理に向いています
006#com.cocolog-nifty.quicktimer.icefloe
007----+----1----+----2----+-----3----+----4----+----5----+----6----+----7
008use AppleScript version "2.8"
009use framework "Foundation"
010use scripting additions
011
012####プリフライトの一覧を取得
013tell application id "com.adobe.Acrobat.Pro"
014  #AppleScript用とJavascript用に2回コマンド実行する
015  do script ("var numPreflight = Preflight.getNumProfiles(app.thermometer); ")
016  set numPreflight to do script ("Preflight.getNumProfiles(app.thermometer); ")
017  log "Preflight:" & numPreflight
018end tell
019set numPreChk to 0
020
021repeat numPreflight times
022  tell application id "com.adobe.Acrobat.Pro"
023    #AppleScript用とJavascript用に2回コマンド実行する
024    do script ("Preflight.getNthProfile(" & numPreChk & ").name;")
025    set theListItem to (do script ("Preflight.getNthProfile(" & numPreChk & ").name;"))
026  end tell
027  if numPreChk = 0 then
028    set listPreflight to theListItem
029  else
030    ##戻り値を改行区切りのテキストにしていく
031    set listPreflight to listPreflight & "\r" & theListItem
032  end if
033  set numPreChk to numPreChk + 1
034end repeat
035##改行区切りテキストをリストにする
036set AppleScript's text item delimiters to "\r"
037set listPreflight to every text item of listPreflight as list
038set AppleScript's text item delimiters to ""
039log listPreflight
040
041##ダイアログ
042set strName to (name of current application) as text
043if strName is "osascript" then
044  tell application "Finder" to activate
045else
046  tell current application to activate
047end if
048
049try
050  set listResponse to (choose from list listPreflight with title "プリフライトリスト" with prompt "プリフライトのリスト" default items (item 5 of listPreflight) OK button name "OK" cancel button name "キャンセル" without multiple selections allowed and empty selection allowed) as list
051  log listResponse
052on error
053  log "エラーしました"
054  return
055end try
056if (item 1 of listResponse) is false then
057  return
058end if
059##ダイアログの戻り値で
060set strProfile to (item 1 of listResponse) as text
061##プリフライトを実行
062tell application id "com.adobe.Acrobat.Pro"
063  activate
064  tell active doc
065    do script "this.preflight(Preflight.getProfileByName(\"" & strProfile & "\"));"
066    set strResponse to (do script ("this.preflight(Preflight.getProfileByName(\"" & strProfile & "\"));")) as text
067    log strResponse
068  end tell
069end tell
AppleScriptで生成しました

|

[As] execute menu item からプリフライトを実行する


サンプルコード

サンプルソース(参考)
行番号ソース
001tell application id "com.adobe.Acrobat.Pro"
002  ###プリフライト実行
003  execute menu item "CALS:Preflight" of menu "Edit"
004end tell
AppleScriptで生成しました

|

より以前の記事一覧

その他のカテゴリー

Accessibility Acrobat Acrobat 2020 Acrobat AddOn Acrobat Annotation Acrobat ARMDC Acrobat AV2 Acrobat BookMark Acrobat Classic Acrobat DC Acrobat Dialog Acrobat Distiller Acrobat Form Acrobat JS Acrobat Manifest Acrobat Menu Acrobat Open Acrobat Plugin Acrobat Preferences Acrobat Preflight Acrobat Python Acrobat Reader Acrobat Reader Localized Acrobat Reference Acrobat SCA Acrobat SCA Updater Acrobat Sequ Acrobat Sign Acrobat Stamps Acrobat Watermark Acrobat Windows Acrobat Windows Reader Admin Admin Account Admin Apachectl Admin configCode Admin Device Management Admin LaunchServices Admin Locationd Admin loginitem Admin Maintenance Admin Mobileconfig Admin Permission Admin Pkg Admin Power Management Admin Printer Admin SetUp Admin SMB Admin Support Admin System Information Admin Tools Admin Users Admin Volumes Admin XProtect Adobe Adobe Bridge Adobe FDKO Adobe Fonts Adobe Reference Adobe RemoteUpdateManager AppKit Apple AppleScript AppleScript do shell script AppleScript List AppleScript ObjC AppleScript Osax AppleScript PDF AppleScript Pictures AppleScript record AppleScript Script Editor AppleScript Script Menu AppleScript Shortcuts AppleScript Shortcuts Events AppleScript System Events AppleScript System Events Plist AppleScript Video Applications AppStore Archive Attributes Automator BackUp Barcode Barcode Decode Barcode QR Bash Basic Basic Path Bluetooth BOX Browser Calendar CD/DVD Choose Chrome CIImage CityCode CloudStorage Color com.apple.LaunchServices.OpenWith Console Contacts CotEditor CURL current application Date&Time defaults delimiters Desktop Device Diff Disk Dock DropBox Droplet eMail Encode % Encode Decode Encode HTML Entity Encode UTF8 Error EXIFData ffmpeg File File Name Finder Firefox Folder FolderAction Fonts Fonts ATS Fonts Python Foxit GIF github Guide HTML Icon Illustrator Image Events Image2PDF ImageOptim Input Dictionary iPhone iWork Javascript Jedit Json Label Language Leading Zero List locationd LRC lsappinfo m3u8 Mail MakePDF Map Math Media Media AVAsset Media AVconvert Media AVFoundation Media AVURLAsset Media Movie Media Music Memo Messages Microsoft Microsoft Edge Microsoft Excel Microsoft Fonts Microsoft Office Mouse Music NetWork Notes NSArray NSArray Sort NSBezierPath NSBitmapImageRep NSBundle NSCFBoolean NSCharacterSet NSColor NSColorList NSData NSDecimalNumber NSDictionary NSError NSEvent NSFileAttributes NSFileManager NSFileManager enumeratorAtURL NSFont NSFontManager NSGraphicsContext NSImage NSIndex NSKeyedArchiver NSKeyedUnarchiver NSLocale NSMetadataItem NSMutableArray NSMutableDictionary NSMutableString NSNotFound NSNumber NSOpenPanel NSPasteboard NSpoint NSPredicate NSRange NSRect NSRegularExpression NSRunningApplication NSScreen NSSize NSString NSString stringByApplyingTransform NSStringCompareOptions NSTask NSTimeZone NSURL NSURL File NSURLBookmark NSURLComponents NSURLResourceKey NSURLSession NSUserDefaults NSUUID NSView NSWorkspace Numbers OAuth OneDrive PDF PDF Pymupdf PDFAnnotation PDFAnnotationWidget PDFContext PDFDisplayBox PDFDocumentPermissions PDFImageRep PDFKit PDFnUP PDFOutline PDFView perl Photoshop PlistBuddy pluginkit plutil postalcode PostScript prefPane Preview Python QuickLook QuickTime ReadMe Regular Expression Reminders ReName Repeat RTF Safari SaveFile ScreenCapture ScreenSaver SF Symbols character id SF Symbols Entity sips Skype Slack Sound Spotlight sqlite SRT StandardAdditions Swift System Settings TCC TemporaryItems Terminal Text Text CSV Text MD Text TSV TextEdit Tools Translate Trash Twitter Typography UI Unit Conversion UTType valueForKeyPath Video VisionKit Visual Studio Code VMware Fusion Wacom webarchive webp Wifi Windows XML XML EPUB XML HTML XML LSSharedFileList XML OPML XML Plist XML RSS XML savedSearch XML SVG XML TTML XML webloc XML xmllint XML XMP YouTube zoom