pdfix-cli 9.1.1__py3-none-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pdfix_cli/__init__.py +23 -0
- pdfix_cli/__main__.py +30 -0
- pdfix_cli/_paths.py +103 -0
- pdfix_cli/_runner.py +64 -0
- pdfix_cli/runtime/LICENSE.txt +4 -0
- pdfix_cli/runtime/README.txt +1 -0
- pdfix_cli/runtime/bin/arm64/libpdf.dylib +0 -0
- pdfix_cli/runtime/bin/arm64/pdfix_app +0 -0
- pdfix_cli/runtime/resources/fix_metadata.json +98 -0
- pdfix_cli/runtime/resources/make_accessible.json +739 -0
- pdfix_cli/runtime/resources/pdf_action.json +3959 -0
- pdfix_cli/runtime/resources/pdf_config.json +4034 -0
- pdfix_cli/runtime/resources/pdfix_settings.json +38 -0
- pdfix_cli/runtime/resources/quick_fix.json +125 -0
- pdfix_cli/runtime/version.txt +1 -0
- pdfix_cli-9.1.1.dist-info/METADATA +121 -0
- pdfix_cli-9.1.1.dist-info/RECORD +21 -0
- pdfix_cli-9.1.1.dist-info/WHEEL +5 -0
- pdfix_cli-9.1.1.dist-info/entry_points.txt +4 -0
- pdfix_cli-9.1.1.dist-info/licenses/LICENSE +4 -0
- pdfix_cli-9.1.1.dist-info/top_level.txt +1 -0
pdfix_cli/__init__.py
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"""PDFix CLI resolver package for pip consumers."""
|
|
2
|
+
|
|
3
|
+
__version__ = "9.1.1"
|
|
4
|
+
|
|
5
|
+
from pdfix_cli._paths import (
|
|
6
|
+
PLATFORM_BINARIES,
|
|
7
|
+
PLATFORM_PACKAGES,
|
|
8
|
+
get_pdfix_cli_package_name,
|
|
9
|
+
get_pdfix_cli_path,
|
|
10
|
+
get_platform_key,
|
|
11
|
+
)
|
|
12
|
+
from pdfix_cli._runner import is_pdfix_cli_available, run_pdfix_cli
|
|
13
|
+
|
|
14
|
+
__all__ = [
|
|
15
|
+
"PLATFORM_BINARIES",
|
|
16
|
+
"PLATFORM_PACKAGES",
|
|
17
|
+
"__version__",
|
|
18
|
+
"get_pdfix_cli_package_name",
|
|
19
|
+
"get_pdfix_cli_path",
|
|
20
|
+
"get_platform_key",
|
|
21
|
+
"is_pdfix_cli_available",
|
|
22
|
+
"run_pdfix_cli",
|
|
23
|
+
]
|
pdfix_cli/__main__.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Console entry points for ``pdfix-cli``, ``pdfix``, and ``pdfix_app``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
from pdfix_cli._runner import run_pdfix_cli
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def main() -> None:
|
|
12
|
+
child = run_pdfix_cli(sys.argv[1:])
|
|
13
|
+
try:
|
|
14
|
+
return_code = child.wait()
|
|
15
|
+
except KeyboardInterrupt:
|
|
16
|
+
child.terminate()
|
|
17
|
+
try:
|
|
18
|
+
child.wait(timeout=5)
|
|
19
|
+
except subprocess.TimeoutExpired:
|
|
20
|
+
child.kill()
|
|
21
|
+
child.wait()
|
|
22
|
+
raise SystemExit(130) from None
|
|
23
|
+
|
|
24
|
+
if return_code < 0:
|
|
25
|
+
raise SystemExit(128 + (-return_code))
|
|
26
|
+
raise SystemExit(return_code)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
if __name__ == "__main__":
|
|
30
|
+
main()
|
pdfix_cli/_paths.py
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"""Platform resolution and native PDFix CLI binary path lookup."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import platform
|
|
6
|
+
import sys
|
|
7
|
+
from pathlib import Path
|
|
8
|
+
|
|
9
|
+
PLATFORM_PACKAGES = {
|
|
10
|
+
"win32-x64": "@pdfix/cli-win32-x64",
|
|
11
|
+
"linux-x64": "@pdfix/cli-linux-x64",
|
|
12
|
+
"linux-arm64": "@pdfix/cli-linux-arm64",
|
|
13
|
+
"darwin-x64": "@pdfix/cli-darwin-x64",
|
|
14
|
+
"darwin-arm64": "@pdfix/cli-darwin-arm64",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
PLATFORM_BINARIES = {
|
|
18
|
+
"win32-x64": ("bin", "x86_64", "pdfix_app.exe"),
|
|
19
|
+
"linux-x64": ("bin", "x86_64", "pdfix_app"),
|
|
20
|
+
"linux-arm64": ("bin", "aarch64", "pdfix_app"),
|
|
21
|
+
"darwin-x64": ("bin", "x86_64", "pdfix_app"),
|
|
22
|
+
"darwin-arm64": ("bin", "arm64", "pdfix_app"),
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_platform_key(
|
|
27
|
+
platform_name: str | None = None,
|
|
28
|
+
machine: str | None = None,
|
|
29
|
+
) -> str:
|
|
30
|
+
"""Return the platform key used to select a PDFix CLI runtime layout."""
|
|
31
|
+
platform_name = platform_name or sys.platform
|
|
32
|
+
machine = (machine or platform.machine()).lower()
|
|
33
|
+
|
|
34
|
+
if platform_name == "win32" and machine in ("amd64", "x86_64"):
|
|
35
|
+
return "win32-x64"
|
|
36
|
+
if platform_name == "linux" and machine in ("amd64", "x86_64"):
|
|
37
|
+
return "linux-x64"
|
|
38
|
+
if platform_name == "linux" and machine in ("aarch64", "arm64"):
|
|
39
|
+
return "linux-arm64"
|
|
40
|
+
if platform_name == "darwin" and machine in ("amd64", "x86_64"):
|
|
41
|
+
return "darwin-x64"
|
|
42
|
+
if platform_name == "darwin" and machine == "arm64":
|
|
43
|
+
return "darwin-arm64"
|
|
44
|
+
|
|
45
|
+
supported = ", ".join(PLATFORM_PACKAGES)
|
|
46
|
+
raise ValueError(
|
|
47
|
+
f"PDFix CLI App is not available for platform {platform_name}-{machine}. "
|
|
48
|
+
f"Supported platforms: {supported}."
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
def get_pdfix_cli_package_name(
|
|
53
|
+
platform_name: str | None = None,
|
|
54
|
+
machine: str | None = None,
|
|
55
|
+
) -> str:
|
|
56
|
+
"""Return the npm-style runtime package name for a supported platform."""
|
|
57
|
+
key = get_platform_key(platform_name, machine)
|
|
58
|
+
return PLATFORM_PACKAGES[key]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _runtime_root() -> Path:
|
|
62
|
+
return Path(__file__).resolve().parent / "runtime"
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
def get_pdfix_cli_path(
|
|
66
|
+
*,
|
|
67
|
+
platform_name: str | None = None,
|
|
68
|
+
machine: str | None = None,
|
|
69
|
+
platform_key: str | None = None,
|
|
70
|
+
cli_path: str | None = None,
|
|
71
|
+
) -> str:
|
|
72
|
+
"""Return the absolute path to the native ``pdfix_app`` executable.
|
|
73
|
+
|
|
74
|
+
Pass ``platform_key`` (e.g. ``darwin-x64``) to resolve a staged layout that
|
|
75
|
+
may differ from the current host architecture.
|
|
76
|
+
"""
|
|
77
|
+
if cli_path is not None:
|
|
78
|
+
resolved = Path(cli_path)
|
|
79
|
+
if not resolved.is_file():
|
|
80
|
+
raise FileNotFoundError(
|
|
81
|
+
f"PDFix CLI App binary was not found at {resolved}."
|
|
82
|
+
)
|
|
83
|
+
return str(resolved)
|
|
84
|
+
|
|
85
|
+
if platform_key is not None:
|
|
86
|
+
if platform_key not in PLATFORM_BINARIES:
|
|
87
|
+
supported = ", ".join(PLATFORM_BINARIES)
|
|
88
|
+
raise ValueError(
|
|
89
|
+
f"Unknown platform key {platform_key}. Supported: {supported}."
|
|
90
|
+
)
|
|
91
|
+
key = platform_key
|
|
92
|
+
else:
|
|
93
|
+
key = get_platform_key(platform_name, machine)
|
|
94
|
+
|
|
95
|
+
relative_parts = PLATFORM_BINARIES[key]
|
|
96
|
+
resolved = _runtime_root().joinpath(*relative_parts)
|
|
97
|
+
if not resolved.is_file():
|
|
98
|
+
package_name = PLATFORM_PACKAGES[key]
|
|
99
|
+
raise FileNotFoundError(
|
|
100
|
+
f"PDFix CLI App binary was not found at {resolved}. "
|
|
101
|
+
f"Reinstall pdfix-cli for platform package {package_name}."
|
|
102
|
+
)
|
|
103
|
+
return str(resolved)
|
pdfix_cli/_runner.py
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"""Spawn helpers for the native PDFix CLI executable."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import subprocess
|
|
6
|
+
from collections.abc import Mapping, Sequence
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
9
|
+
from pdfix_cli._paths import get_pdfix_cli_path
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def is_pdfix_cli_available(
|
|
13
|
+
*,
|
|
14
|
+
platform_name: str | None = None,
|
|
15
|
+
machine: str | None = None,
|
|
16
|
+
platform_key: str | None = None,
|
|
17
|
+
cli_path: str | None = None,
|
|
18
|
+
) -> bool:
|
|
19
|
+
"""Return ``True`` when the native PDFix CLI executable can be resolved."""
|
|
20
|
+
try:
|
|
21
|
+
get_pdfix_cli_path(
|
|
22
|
+
platform_name=platform_name,
|
|
23
|
+
machine=machine,
|
|
24
|
+
platform_key=platform_key,
|
|
25
|
+
cli_path=cli_path,
|
|
26
|
+
)
|
|
27
|
+
return True
|
|
28
|
+
except (FileNotFoundError, ValueError):
|
|
29
|
+
return False
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def run_pdfix_cli(
|
|
33
|
+
args: Sequence[str] | None = None,
|
|
34
|
+
options: Mapping[str, Any] | None = None,
|
|
35
|
+
) -> subprocess.Popen[str]:
|
|
36
|
+
"""Spawn the native PDFix CLI executable.
|
|
37
|
+
|
|
38
|
+
The child process inherits stdio by default so the CLI behaves like a
|
|
39
|
+
normal command-line tool. Pass ``spawn_options`` to override
|
|
40
|
+
:func:`subprocess.Popen` options such as ``stdio``, ``cwd``, or ``env``.
|
|
41
|
+
"""
|
|
42
|
+
if args is None:
|
|
43
|
+
args = []
|
|
44
|
+
if not isinstance(args, Sequence) or isinstance(args, (str, bytes)):
|
|
45
|
+
raise TypeError("run_pdfix_cli(args, options) expects args to be a sequence.")
|
|
46
|
+
|
|
47
|
+
options = dict(options or {})
|
|
48
|
+
resolved_cli_path = options.get("cli_path") or get_pdfix_cli_path(
|
|
49
|
+
platform_name=options.get("platform_name"),
|
|
50
|
+
machine=options.get("machine"),
|
|
51
|
+
platform_key=options.get("platform_key"),
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
spawn_options = {
|
|
55
|
+
"stdin": None,
|
|
56
|
+
"stdout": None,
|
|
57
|
+
"stderr": None,
|
|
58
|
+
}
|
|
59
|
+
spawn_options.update(options.get("spawn_options") or {})
|
|
60
|
+
|
|
61
|
+
return subprocess.Popen(
|
|
62
|
+
[resolved_cli_path, *args],
|
|
63
|
+
**spawn_options,
|
|
64
|
+
)
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
PDFix SDK Lite is licensed under Apache 2.0 license https://www.apache.org/licenses/LICENSE-2.0.
|
|
2
|
+
Other versions of the PDFix SDK are licenses under license published on https://pdfix.net/terms.
|
|
3
|
+
|
|
4
|
+
For more information about the PDFix SDK versions please visit https://pdfix.net/pricing
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
For more information please check https://pdfix.net/support/getting-started/
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "fix_metadata_complete",
|
|
3
|
+
"title": "Fix Metadata (Complete)",
|
|
4
|
+
"desc": "Repair, normalize, and rebuild document metadata, automatically set the document title, and apply the PDF/UA identifier",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"repair",
|
|
7
|
+
"normalize",
|
|
8
|
+
"metadata",
|
|
9
|
+
"title",
|
|
10
|
+
"document title",
|
|
11
|
+
"xmp",
|
|
12
|
+
"pdf/ua",
|
|
13
|
+
"info dictionary"
|
|
14
|
+
],
|
|
15
|
+
"version": "0.2.1",
|
|
16
|
+
"min_sdk_version": "8.8.0",
|
|
17
|
+
"max_sdk_version": "",
|
|
18
|
+
"release_date": "2026-03-21",
|
|
19
|
+
"category": "",
|
|
20
|
+
"icon": "fix_metadata",
|
|
21
|
+
"settings": {
|
|
22
|
+
"stop_on_action_failure": false
|
|
23
|
+
},
|
|
24
|
+
"actions": [
|
|
25
|
+
{
|
|
26
|
+
"name": "fix_metadata",
|
|
27
|
+
"title": "Fix and Normalize Metadata",
|
|
28
|
+
"desc": "Repair, normalize, and reset document XMP metadata to improve standards compliance, consistency, and accessibility.",
|
|
29
|
+
"params": [
|
|
30
|
+
{
|
|
31
|
+
"name": "reset_metadata",
|
|
32
|
+
"value": true
|
|
33
|
+
}
|
|
34
|
+
]
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": "set_title",
|
|
38
|
+
"title": "Set Title from First Heading",
|
|
39
|
+
"desc": "Set the document title from the first matching structure tag (typically H1).",
|
|
40
|
+
"params": [
|
|
41
|
+
{
|
|
42
|
+
"name": "title_type",
|
|
43
|
+
"value": "1"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"name": "custom_text",
|
|
47
|
+
"value": ""
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"name": "description_tag",
|
|
51
|
+
"value": "H1"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
"name": "overwrite",
|
|
55
|
+
"value": false
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"name": "set_title",
|
|
61
|
+
"title": "Set Title from File Name",
|
|
62
|
+
"desc": "Use the file name as the document title when no title was detected in the document structure.",
|
|
63
|
+
"params": [
|
|
64
|
+
{
|
|
65
|
+
"name": "title_type",
|
|
66
|
+
"value": "2"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"name": "custom_text",
|
|
70
|
+
"value": ""
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "description_tag",
|
|
74
|
+
"value": ""
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "overwrite",
|
|
78
|
+
"value": false
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"name": "set_pdf_ua_standard",
|
|
84
|
+
"title": "Set PDF/UA Identifier",
|
|
85
|
+
"desc": "Declare the PDF/UA conformance level in the document metadata.",
|
|
86
|
+
"params": [
|
|
87
|
+
{
|
|
88
|
+
"name": "part_number",
|
|
89
|
+
"value": "1"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"name": "rev_number",
|
|
93
|
+
"value": "2023"
|
|
94
|
+
}
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
]
|
|
98
|
+
}
|