Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
213 commits
Select commit Hold shift + click to select a range
6561cb1
make SortSelectedPagesForBooklet a public method. move signatures log…
adamgreenhall Feb 28, 2024
fd34b05
Fix #821
hhrutter Mar 6, 2024
5ccea97
Fix #135
hhrutter Mar 9, 2024
57030ec
Fix #828
hhrutter Mar 14, 2024
6158a91
Another fix for #828
hhrutter Mar 15, 2024
3282d8a
Fix #823
hhrutter Mar 19, 2024
aff022f
Fix #835, Add config flags for optimization
hhrutter Mar 20, 2024
26c5fb2
Fix #826
hhrutter Mar 21, 2024
c5db1d9
Fix #826
hhrutter Mar 21, 2024
b9c7a89
Fix #838
hhrutter Mar 22, 2024
9d76f84
Squash commits
adamgreenhall Feb 28, 2024
6e48669
Merge in PR #817
hhrutter Mar 26, 2024
6d95797
Fix #839
hhrutter Apr 6, 2024
05d2d1f
Fix #841
hhrutter Apr 6, 2024
a647579
Fix #843
hhrutter Apr 8, 2024
deb697d
Fix #847
hhrutter Apr 8, 2024
d568466
Fix #844
hhrutter Apr 8, 2024
87abdcc
Fix #849
hhrutter Apr 11, 2024
f783bf2
Fix #834
hhrutter Apr 15, 2024
0988c5e
Add PDF 2.0 encryption
hhrutter Apr 23, 2024
2d06bc7
Add missing author info
xelan Apr 23, 2024
5bafded
Merge PR #855
hhrutter Apr 23, 2024
7188e6a
Fix #852
hhrutter Apr 23, 2024
fc09c1f
Lazily parse ObjectStream objects.
fancycode Mar 20, 2024
82f1929
filter: Add API to partially decode data.
fancycode Mar 21, 2024
df5d53d
Lazily decode data of StreamObject objects.
fancycode Mar 21, 2024
91619f0
Write out LazyObjectStreamObject without temporary decoding.
fancycode Mar 21, 2024
ca6d15e
Avoid pointer receiver and don't call PDFString of lazy objects inter…
fancycode Apr 24, 2024
b462c01
Handle case where referenced stream length does not exist.
fancycode Apr 24, 2024
41333df
Cancel parsing in "buffer" if context is cancelled.
fancycode Apr 24, 2024
38b2992
Fix #851
hhrutter Apr 24, 2024
576f15e
Bump version
hhrutter Apr 24, 2024
d1433b9
Fix #862
hhrutter Apr 29, 2024
7cae81e
Fix #819, clean up
hhrutter May 13, 2024
d38d51b
Fix #867
hhrutter May 16, 2024
1f3886c
Fix #853
hhrutter May 16, 2024
551f87e
Fix #767
hhrutter May 20, 2024
3406273
Fix #871
hhrutter May 23, 2024
c342327
Allow property values containing an equal sign
xelan May 29, 2024
a467f3c
Improve reading corrupted files
hhrutter Jun 15, 2024
a938dd5
Fix #886
hhrutter Jun 15, 2024
12ffda1
Fix #891
hhrutter Jun 19, 2024
c3d8e18
Fix #885
hhrutter Jun 28, 2024
402000d
Fix #850
hhrutter Jun 30, 2024
cd40e60
fix(stamp): Add Support for Soft Mask in RGBA Image Buffer
toshi1127 Jun 21, 2024
699a216
Allow to set the PDF Creator with properties command
xelan Jun 3, 2024
b54a425
Fix #903
hhrutter Jun 30, 2024
88bee8f
Fix #898, clean up
hhrutter Jun 30, 2024
d87622b
Fix #687, clean up
hhrutter Jul 7, 2024
a1d0f95
Fix #908
hhrutter Jul 7, 2024
6a9df2e
Fix #907
hhrutter Jul 7, 2024
c0c7f90
Fix #890, #915
hhrutter Jul 8, 2024
2059677
Fix #910
hhrutter Jul 15, 2024
e987369
Fix #912
hhrutter Jul 18, 2024
649f511
Fix #921
hhrutter Jul 24, 2024
68d2f39
Fix #628, #924
hhrutter Aug 1, 2024
fdaf5a4
Fix #911
hhrutter Aug 2, 2024
c53ab74
Cleanup annotations
hhrutter Aug 4, 2024
1abb9f6
Fix #926
hhrutter Aug 4, 2024
d7593cb
Fix #918
hhrutter Aug 5, 2024
3aff1b0
Add support for FreeText annotation.
hhrutter Aug 20, 2024
b9c28ae
Fix #930
hhrutter Aug 20, 2024
c6decf5
Fix #932
hhrutter Aug 24, 2024
ee932c4
Fix #931
hhrutter Aug 25, 2024
8e281b1
Add support for PolyLine and Polygon annotations.
hhrutter Aug 29, 2024
df5e3c7
Add support for Line annotation.
hhrutter Aug 30, 2024
1bdc717
Add support for Caret annotation.
hhrutter Aug 30, 2024
66fee12
Bump version
hhrutter Aug 31, 2024
ec0d594
Add Matsumoto Toshi to contributors.
hhrutter Aug 31, 2024
5677395
Use Docker ENTRYPOINT rather than CMD
carlwilson Sep 7, 2024
e2441b9
Fix #941
hhrutter Sep 8, 2024
0174d86
Fix Docker execution instructions in README.
carlwilson Sep 7, 2024
a3de045
Add Carl Wilson to contributors.
hhrutter Sep 8, 2024
75f26b2
Fix #935, Clean up
hhrutter Sep 8, 2024
3f7e650
FIX: Docker run command in README
carlwilson Sep 9, 2024
748b3cb
Merge remote-tracking branch 'upstream/master' into docker-entrypoint
carlwilson Sep 9, 2024
007356f
Merge pull request #947 from carlwilson/docker-entrypoint
hhrutter Sep 12, 2024
84cdec0
Fix #948
hhrutter Sep 13, 2024
e2a8e58
Fix #951
hhrutter Sep 18, 2024
8711370
Fix #955
hhrutter Sep 26, 2024
9749d6d
Fix #953
hhrutter Sep 26, 2024
ac650d9
Fix #940
hhrutter Sep 28, 2024
9d2c1fd
Add LNAhri to contributors.
hhrutter Sep 28, 2024
32c6c24
Cleanup
hhrutter Sep 29, 2024
bb789c7
Fix form validation
hhrutter Sep 29, 2024
1bbdade
Cleanup
hhrutter Sep 29, 2024
9a32118
Fix #455
hhrutter Oct 5, 2024
dc38554
Fix #897
hhrutter Oct 5, 2024
23311b7
Fix #859, #965
hhrutter Oct 13, 2024
b1b9f99
Fix #868, add config parms offline, timeout
hhrutter Oct 14, 2024
22ebeff
Booklet 8up orientations (#969)
adamgreenhall Oct 18, 2024
a7c32de
Add warning if config.yml is outdated, add config reset cmd.
hhrutter Oct 21, 2024
853c877
Bump version
hhrutter Oct 22, 2024
c703429
Fix config file handling
hhrutter Oct 24, 2024
1d4a5a6
Bump version
hhrutter Oct 24, 2024
248f162
Fix #972, 973
hhrutter Oct 27, 2024
52954c8
Cleanup, improve cli validation
hhrutter Nov 1, 2024
16372f9
Fix #981, speedup optimization, merge: optimize flag
hhrutter Nov 3, 2024
96c3c37
Fix #985
hhrutter Nov 4, 2024
25b1c1a
Fix #991
hhrutter Nov 8, 2024
edccc8f
Fix #988
hhrutter Nov 9, 2024
a7ec763
Fix #984
hhrutter Nov 9, 2024
9e9cb79
Fix#987
hhrutter Nov 9, 2024
3af10ec
Cleanup
hhrutter Nov 10, 2024
c4f314b
Cleanup
hhrutter Nov 17, 2024
b9b3d0f
Fix #1001
hhrutter Nov 25, 2024
e24743a
Fix parsing of objects with very large dictionaries (#999)
fancycode Nov 28, 2024
302ee6e
Prevent division by zero in extractXRefTableEntriesFromXRefStream (#1…
fancycode Nov 28, 2024
2421277
Check if "entry.Offset" is nil before dereferencing. (#1010)
fancycode Nov 28, 2024
ef64980
Correctly handle empty type field length in cross reference streams. …
fancycode Nov 28, 2024
53ee8f3
Fix #1008
hhrutter Dec 1, 2024
a728f8c
#Fix 982
hhrutter Dec 2, 2024
ff51203
Cleanup ReadMe
hhrutter Dec 2, 2024
4f1eef0
Don't decrypt "Contents" of "DocTimeStamp" signatures. (#1027)
fancycode Dec 9, 2024
56bed9f
Fix typos (#1029)
deining Dec 9, 2024
01d72b1
Handle missing page tree node type for pages. (#1021)
fancycode Dec 11, 2024
83c895e
Support float page rotation with zero fractional part. (#1019)
fancycode Dec 11, 2024
6659896
Fix typos (#1034)
deining Dec 11, 2024
0f856f7
Implement dependabot (#1028)
deining Dec 12, 2024
6822068
Synopsis: improve mode usage message (#1036)
deining Dec 12, 2024
c8e0085
Cleanup
hhrutter Dec 12, 2024
1e4cb9f
Fix #1058 Use relaxed validation for dict=Square entry=RD (#1063)
vishal-at Jan 7, 2025
4e0e0db
Fix #1049
hhrutter Jan 8, 2025
3e64e1f
Handle duplicate keys
hhrutter Jan 16, 2025
a73d706
Fix #1025
hhrutter Jan 16, 2025
4379427
Fix #888
hhrutter Jan 19, 2025
b05d395
Fix #1077, clean up
hhrutter Jan 22, 2025
a9d7863
Fix #1080
hhrutter Jan 23, 2025
4ba7f28
Disable optimization for verbose validate via CLI
hhrutter Jan 24, 2025
b60bc1c
Fix #1076
hhrutter Jan 24, 2025
6a2b4f7
Fix #1065
hhrutter Jan 25, 2025
a966a9c
Fix #1047
hhrutter Jan 29, 2025
9b1ead8
Fix #1081
hhrutter Feb 2, 2025
4a2f04f
Fix #1041
hhrutter Feb 2, 2025
b8f82d6
Fix #1073, #1092, bump go.mod
hhrutter Feb 19, 2025
eb132fb
Avoid duplicate keyword search (#1066)
fancycode Feb 21, 2025
9310068
Fix #1072
hhrutter Feb 21, 2025
0e1db94
Fix #1090
hhrutter Feb 21, 2025
4d89d03
Fix #1091
hhrutter Feb 22, 2025
1d3c07e
Fix #1098
hhrutter Feb 22, 2025
bad35cb
Fix #1089
hhrutter Feb 23, 2025
6015ff8
Fix #1100
hhrutter Feb 24, 2025
05bd280
Fix #1064
hhrutter Feb 24, 2025
d8da983
Fix #1015
hhrutter Feb 26, 2025
f188cec
Fix #1017
hhrutter Feb 26, 2025
ed8b0f9
Fix #1016
hhrutter Mar 2, 2025
4b9cd31
Fix #1099
hhrutter Mar 3, 2025
ce09a83
Fix form field validation.
hhrutter Mar 8, 2025
3eaac1d
Add signature command
hhrutter Sep 8, 2024
ba010c9
Fix #1114
hhrutter Apr 21, 2025
f11409b
Fix #1111
hhrutter Apr 21, 2025
106feff
Fix #1116, clean up
hhrutter Apr 21, 2025
4804a29
Bump version, clean up
hhrutter Apr 21, 2025
cd39124
Fix config parsing, bump version
hhrutter Apr 22, 2025
6b239c6
Fix ensure config file
hhrutter Apr 23, 2025
23a991a
Bump version
hhrutter Apr 23, 2025
c501452
Cleanup goreleaser.yml
hhrutter Apr 23, 2025
a22ca4a
Fix #1118
hhrutter Apr 27, 2025
e2db5a7
Fix #1142
hhrutter May 1, 2025
35b965c
Fix #1119
hhrutter May 1, 2025
87eb8c6
Fixed documentation links in README.md
solintllc-robert May 2, 2025
26289b2
Fix #1117
hhrutter May 2, 2025
c3d1859
Update Dockerfile
frob May 6, 2025
a7745cf
Fix #1056
hhrutter May 7, 2025
f631286
Fix #1149
hhrutter May 8, 2025
f49774f
Fix #1152
hhrutter May 8, 2025
838d76f
Bump golang.org/x/text from 0.24.0 to 0.25.0
dependabot[bot] May 12, 2025
1636ee9
Bump golang.org/x/image from 0.26.0 to 0.27.0
dependabot[bot] May 12, 2025
7aba577
Bump golang.org/x/crypto from 0.37.0 to 0.38.0
dependabot[bot] May 12, 2025
087bb73
Fix #1085
hhrutter May 13, 2025
0ec9891
Fix #1113
hhrutter May 14, 2025
73e464f
Add PDF2.0 conforming fileSpecDict validation
hhrutter May 14, 2025
5713f47
Fix #1107
hhrutter May 15, 2025
eaddf27
Fix #1163
hhrutter May 21, 2025
a9a8417
Cleanup
hhrutter May 22, 2025
3bfc3c7
Fix #1165
hhrutter May 22, 2025
def70a3
Fix #1168
hhrutter May 22, 2025
106bce9
Add cert inspect cmd
hhrutter May 28, 2025
b6c1c9d
Cleanup
hhrutter May 28, 2025
d240a95
Fix #1171
hhrutter May 28, 2025
9a9da09
Bump version
hhrutter May 28, 2025
6bf0f53
Update contributors
hhrutter May 29, 2025
cea5481
Relax date validation for 1 digit seconds
hhrutter May 30, 2025
ebac205
Fix #1173
hhrutter May 30, 2025
042c910
Fixes #1183 - Extract ExtGState refrerenced images
SveLil Jun 11, 2025
1b7cfff
Cleanup
hhrutter Jun 18, 2025
b419ce4
Upgrade go.mod
hhrutter Jun 18, 2025
3744f3c
Fix #1185
hhrutter Jun 21, 2025
b108369
Fix #1177
hhrutter Jun 22, 2025
6cfff8e
Fix 1187
hhrutter Jun 22, 2025
9e69220
Fix #1176
hhrutter Jun 28, 2025
f55e600
Fix #1189
hhrutter Jul 8, 2025
79a1276
Fix #1194
hhrutter Jul 9, 2025
b6e9642
Add support for inherited textfields
hhrutter Jul 13, 2025
fd00754
Cleanup
hhrutter Jul 19, 2025
fc389b5
Cleanup
hhrutter Jul 22, 2025
cca499f
Cleanup
hhrutter Jul 28, 2025
bca1778
Fix #1195
hhrutter Jul 29, 2025
c5b2e7c
Fix #1166
hhrutter Jul 29, 2025
8f53738
Fix #1156
hhrutter Jul 29, 2025
eb8f476
Cleanup
hhrutter Aug 3, 2025
7eaf898
Cleanup
hhrutter Aug 28, 2025
721e78b
Bump go.mod
hhrutter Aug 28, 2025
6dad16b
Fix #1216
hhrutter Aug 29, 2025
5715b95
Bump actions/checkout from 4 to 5
dependabot[bot] Aug 18, 2025
975ba8b
Cleanup
hhrutter Sep 15, 2025
ff50537
Syncup dependabot changes
hhrutter Sep 15, 2025
8c709b4
Bump actions/setup-go from 5 to 6
dependabot[bot] Sep 8, 2025
45fd922
Upgrade build to go1.25
hhrutter Sep 15, 2025
670efa4
Fix #1230
hhrutter Sep 29, 2025
565bbca
Fix #1235
hhrutter Oct 5, 2025
9550c2c
Merge remote-tracking branch 'upstream/master' into latest-go-version
rahul-panzade Oct 7, 2025
87341e0
pull latest code from master
rahul-panzade Oct 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: 2
updates:
# Enable version updates for GitHub action workflows
- package-ecosystem: "github-actions"
directory: "/"
# Check for updates to GitHub Actions once per week
schedule:
interval: "weekly"
open-pull-requests-limit: 10
# Enable version updates for Go modules
- package-ecosystem: gomod
directory: /
# Check for updates to Go modules once per week
schedule:
interval: "weekly"
open-pull-requests-limit: 10
6 changes: 4 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
## Thank you for your contribution!

1. Please do not create a Pull Request without creating an issue first.
1. **Please do not create a Pull Request without creating an issue first.**

2. **Any** change needs to be discussed before proceeding.
2. **Any** change needs to be discussed within the issue before proceeding.

3. Issue discussion will determine further steps like whether a PR is needed or not.

3. Please provide enough information for PR review.

Expand Down
19 changes: 12 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,29 @@ jobs:
goarch: arm64
- goos: linux
goarch: amd64
- goos: linux
goarch: arm
goarm: 7
- goos: linux
goarch: arm64
- goos: windows
goarch: amd64
go:
- '1.20.x'
- '1.21.x'
- '1.24.x'
- '1.25.x'
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v5

- name: Set up Go ${{ matrix.go }}
uses: actions/setup-go@v4
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go }}

- run: go version

- name: Checkout repo
uses: actions/checkout@v3

- name: Go vet
run: go vet -v ./...

Expand All @@ -40,7 +45,7 @@ jobs:
with:
flag-name: Go-${{ matrix.go }}
parallel: true

finish:
needs: test
runs-on: ubuntu-latest
Expand Down
58 changes: 39 additions & 19 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,35 @@
version: 2

builds:
- main: ./cmd/pdfcpu
env:
- CGO_ENABLED=0
ldflags:
- '-s -w -X main.version={{.Version}} -X github.com/pdfcpu/pdfcpu/pkg/pdfcpu.VersionStr={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -X main.builtBy=goreleaser'
goos:
- js
- linux
- darwin
- windows
goarch:
- "386"
- arm64
- wasm
- amd64
- main: ./cmd/pdfcpu
env:
- CGO_ENABLED=0
ldflags:
- '-s -w -X main.version={{.Version}} -X github.com/pdfcpu/pdfcpu/pkg/pdfcpu.VersionStr={{.Version}} -X main.commit={{.ShortCommit}} -X main.date={{.Date}} -X main.builtBy=goreleaser'
goos:
- linux
- darwin
- windows
- js
goarch:
- amd64
- arm64
- arm
- wasm
- "386"
goarm:
- 7
ignore:
- goos: windows
goarch: arm
goarm: 7
- goos: windows
goarch: arm64

dist: ./dist

archives:
-
format: tar.xz
- format: tar.xz
format_overrides:
- goos: windows
format: zip
Expand All @@ -40,5 +52,13 @@ changelog:
sort: asc
filters:
exclude:
- '^docs:'
- '^test:'
- '^docs:'
- '^test:'

release:
github:
owner: pdfcpu
name: pdfcpu
draft: false # Optional: Set to true if you want to create drafts and not publish immediately
prerelease: false # Optional: Set to true if it's a prerelease

9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# /data # exit // exit container

# Start from the latest golang base image
FROM golang:latest as builder
FROM golang:latest AS builder

# install
RUN go install github.com/pdfcpu/pdfcpu/cmd/pdfcpu@latest
Expand All @@ -39,9 +39,10 @@ COPY --from=builder /go/bin ./
# Export path of executable
ENV PATH="${PATH}:/root"

WORKDIR /data
VOLUME /app
WORKDIR /app

# Command to run executable
CMD pdfcpu && echo && pdfcpu version -v
# Entrypoint for container default executable
ENTRYPOINT ["pdfcpu"]


39 changes: 23 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# pdfcpu: a Go PDF processor
# pdfcpu: a Go PDF processor and CLI

[![Open in Visual Studio Code](https://img.shields.io/static/v1?logo=visualstudiocode&label=&message=Open%20in%20Visual%20Studio%20Code&labelColor=2c2c32&color=007acc&logoColor=007acc)](https://open.vscode.dev/pdfcpu/pdfcpu)
[![Test](https://github.com/pdfcpu/pdfcpu/workflows/Test/badge.svg)](https://github.com/pdfcpu/pdfcpu/actions)
[![Coverage Status](https://coveralls.io/repos/github/pdfcpu/pdfcpu/badge.svg?branch=master)](https://coveralls.io/github/pdfcpu/pdfcpu?branch=master)
[![GoDoc](https://godoc.org/github.com/pdfcpu/pdfcpu?status.svg)](https://pkg.go.dev/github.com/pdfcpu/pdfcpu)
[![Go Report Card](https://goreportcard.com/badge/github.com/pdfcpu/pdfcpu)](https://goreportcard.com/report/github.com/pdfcpu/pdfcpu)
[![Hex.pm](https://img.shields.io/hexpm/l/plug.svg)](https://opensource.org/licenses/Apache-2.0)
[![Gurubase](https://img.shields.io/badge/Gurubase-Ask%20pdfcpu%20Guru-006BFF)](https://gurubase.io/g/pdfcpu)

[![Latest release](https://img.shields.io/github/release/pdfcpu/pdfcpu.svg)](https://github.com/pdfcpu/pdfcpu/releases)
[![](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/hhrutter)


<a href="https://pdfcpu.io"><img src="resources/logoSmall.png" width="150"></a>
<a href="https://pdfa.org"><img src="resources/pdfa.png" width="75"></a>

pdfcpu is a PDF processing library written in [Go](http://golang.org) supporting encryption.
It provides both an API and a CLI. Supported are all versions up to PDF 1.7 (ISO-32000).
pdfcpu is a PDF processing library written in [Go](https://go.dev/) that supports encryption and offers both an API and a command-line interface (CLI). It is compatible with all PDF versions with basic support and ongoing improvement for PDF 2.0 (ISO-32000-2).

Support for PDF 2.0 is basic and ongoing work.

## Motivation

Expand All @@ -41,7 +42,8 @@ This is an effort to build a comprehensive PDF processing library from the groun

## Focus

The main focus lies on strong support for batch processing and scripting via a rich command line. At the same time pdfcpu wants to make it easy to integrate PDF processing into your Go based backend system by providing a robust command set.
The primary emphasis is on providing robust assistance for batch processing and scripting through a comprehensive command-line interface.
Simultaneously, pdfcpu aims to simplify the integration of PDF processing into your Go-based backend system by offering a versatile set of commands.

## Command Set

Expand All @@ -50,10 +52,12 @@ The main focus lies on strong support for batch processing and scripting via a r
* [booklet](https://pdfcpu.io/generate/booklet)
* [bookmarks](https://pdfcpu.io/bookmarks/bookmarks)
* [boxes](https://pdfcpu.io/boxes/boxes)
* [certificates](https://pdfcpu.io/core/certs)
* [change owner password](https://pdfcpu.io/encrypt/change_opw)
* [change user password](https://pdfcpu.io/encrypt/change_upw)
* [collect](https://pdfcpu.io/core/collect)
* [create](https://pdfcpu.io/generate/create)
* [config](https://pdfcpu.io/config/config)
* [create](https://pdfcpu.io/create/create)
* [crop](https://pdfcpu.io/core/crop)
* [cut](https://pdfcpu.io/generate/cut)
* [decrypt](https://pdfcpu.io/encrypt/decryptPDF)
Expand All @@ -73,25 +77,27 @@ The main focus lies on strong support for batch processing and scripting via a r
* [pagelayout](https://pdfcpu.io/pagelayout/pagelayout)
* [pagemode](https://pdfcpu.io/pagemode/pagemode)
* [pages](https://pdfcpu.io/pages/pages)
* [permissions](https://pdfcpu.io/encrypt/perm_add)
* [permissions](https://pdfcpu.io/encrypt/perm_set)
* [portfolio](https://pdfcpu.io/portfolio/portfolio)
* [poster](https://pdfcpu.io/generate/poster)
* [properties](https://pdfcpu.io/properties/properties)
* [resize](https://pdfcpu.io/core/resize)
* [rotate](https://pdfcpu.io/core/rotate)
* [signatures](http://pdfcpu.io/core/sign)
* [split](https://pdfcpu.io/core/split)
* [stamp](https://pdfcpu.io/core/stamp)
* [trim](https://pdfcpu.io/core/trim)
* [validate](https://pdfcpu.io/core/validate) 👉 now including rudimentory support for PDF 2.0
* [validate](https://pdfcpu.io/core/validate)
* [viewerpref](https://pdfcpu.io/viewerpref/viewerpref)
* [watermark](https://pdfcpu.io/core/watermark)
* [zoom](https://pdfcpu.io/core/zoom)

## Documentation

* The main entry point is [pdfcpu.io](https://pdfcpu.io).
* For CLI examples also go to [pdfcpu.io](https://pdfcpu.io). There you will find explanations of all the commands and their parameters.
* For API examples of all pdfcpu operations please refer to [GoDoc](https://pkg.go.dev/github.com/pdfcpu/pdfcpu/pkg/api).
* [pdfcpu.io](https://pdfcpu.io)
* [API tests](https://github.com/pdfcpu/pdfcpu/tree/master/pkg/api/test)
* [API samples](https://github.com/pdfcpu/pdfcpu/tree/master/pkg/samples)
* CLI usage: `$ pdfcpu help cmd`

### GoDoc

Expand Down Expand Up @@ -147,10 +153,10 @@ $ pdfcpu version

### Run in a Docker container

```
```shell
$ docker build -t pdfcpu .
# mount current folder into container to process local files
$ docker run -it --mount type=bind,source="$(pwd)",target=/app pdfcpu ./pdfcpu validate /app/pdfs/a.pdf
# mount current host folder into container as /app to process files in the local host folder
$ docker run -it -v "$(pwd)":/app pdfcpu validate a.pdf
```

## Contributing
Expand Down Expand Up @@ -204,7 +210,8 @@ Thanks 💚 goes to these wonderful people:
| [<img src="https://avatars.githubusercontent.com/u/15472552?v=4" width="100px"/><br/><sub><b>Rafael Garcia Argente</b></sub>](https://github.com/rgargente) | [<img src="https://avatars.githubusercontent.com/u/710057?v=4" width="100px"/><br/><sub><b>truyet</b></sub>](https://github.com/truyet) | [<img src="https://avatars.githubusercontent.com/u/5031217?v=4" width="100px"/><br/><sub><b>Christian Nicola</b></sub>](https://github.com/christiannicola) | [<img src="https://avatars.githubusercontent.com/u/3233970?v=4" width="100px"/><br/><sub><b>Benjamin Krill</b></sub>](https://github.com/kben) | [<img src="https://avatars.githubusercontent.com/u/26521615?v=4" width="100px"/><br/><sub><b>Peter Wyatt</b></sub>](https://github.com/petervwyatt) | [<img src="https://avatars.githubusercontent.com/u/3142701?v=4" width="100px"/><br/><sub><b>Kroum Tzanev</b></sub>](https://github.com/kpym) | [<img src="https://avatars.githubusercontent.com/u/992878?v=4" width="100px"/><br/><sub><b>Stefan Huber</b></sub>](https://github.com/signalwerk) |
| [<img src="https://avatars.githubusercontent.com/u/59667587?v=4" width="100px"/><br/><sub><b>Juan Iscar</b></sub>](https://github.com/juaismar) | [<img src="https://avatars.githubusercontent.com/u/20135478?v=4" width="100px"/><br/><sub><b>Eng Zer Jun</b></sub>](https://github.com/Juneezee) | [<img src="https://avatars.githubusercontent.com/u/28459131?v=4" width="100px"/><br/><sub><b>Dmitry Ivanov</b></sub>](https://github.com/hant0508)|[<img src="https://avatars.githubusercontent.com/u/16866547?v=4" width="100px"/><br/><sub><b>Rene Kaufmann</b></sub>](https://github.com/HeavyHorst)|[<img src="https://avatars.githubusercontent.com/u/26827864?v=4" width="100px"/><br/><sub><b>Christian Heusel</b></sub>](https://github.com/christian-heusel) | [<img src="https://avatars.githubusercontent.com/u/305673?v=4" width="100px"/><br/><sub><b>Chris</b></sub>](https://github.com/freshteapot) | [<img src="https://avatars.githubusercontent.com/u/2892794?v=4" width="100px"/><br/><sub><b>Lukasz Czaplinski</b></sub>](https://github.com/scoiatael) |
[<img src="https://avatars.githubusercontent.com/u/49206635?v=4" width="100px"/><br/><sub><b>Joel Silva Schutz</b></sub>](https://github.com/joelschutz) | [<img src="https://avatars.githubusercontent.com/u/28219076?v=4" width="100px"/><br/><sub><b>semvis123</b></sub>](https://github.com/semvis123) | [<img src="https://avatars.githubusercontent.com/u/8717479?v=4" width="100px"/><br/><sub><b>guangwu</b></sub>](https://github.com/testwill) | [<img src="https://avatars.githubusercontent.com/u/4014912?v=4" width="100px"/><br/><sub><b>Yoshiki Nakagawa</b></sub>](https://github.com/yyoshiki41) | [<img src="https://avatars.githubusercontent.com/u/432860?v=4" width="100px"/><br/><sub><b>Steve van Loben Sels</b></sub>](https://github.com/stevevls) | [<img src="https://avatars.githubusercontent.com/u/6083533?v=4" width="100px"/><br/><sub><b>Yaofu</b></sub>](https://github.com/mygityf) | [<img src="https://avatars.githubusercontent.com/u/15724278?v=4" width="100px"/><br/><sub><b>vsenko</b></sub>](https://github.com/vsenko) |
[<img src="https://avatars.githubusercontent.com/u/16507?v=4" width="100px"/><br/><sub><b>Alexis Hildebrandt</b></sub>](https://github.com/afh) | [<img src="https://avatars.githubusercontent.com/u/1395040?v=4" width="100px"/><br/><sub><b>Sivukhin Nikita</b></sub>](https://github.com/sivukhin) | [<img src="https://avatars.githubusercontent.com/u/247730?v=4" width="100px"/><br/><sub><b>Joachim Bauch</b></sub>](https://github.com/fancycode)| [<img src="https://avatars.githubusercontent.com/u/127291996?v=4" width="100px"/><br/><sub><b>kalimit</b></sub>](https://github.com/kalimit) | | |
[<img src="https://avatars.githubusercontent.com/u/16507?v=4" width="100px"/><br/><sub><b>Alexis Hildebrandt</b></sub>](https://github.com/afh) | [<img src="https://avatars.githubusercontent.com/u/1395040?v=4" width="100px"/><br/><sub><b>Sivukhin Nikita</b></sub>](https://github.com/sivukhin) | [<img src="https://avatars.githubusercontent.com/u/247730?v=4" width="100px"/><br/><sub><b>Joachim Bauch</b></sub>](https://github.com/fancycode) | [<img src="https://avatars.githubusercontent.com/u/127291996?v=4" width="100px"/><br/><sub><b>kalimit</b></sub>](https://github.com/kalimit) | [<img src="https://avatars.githubusercontent.com/u/5080535?v=4" width="100px"/><br/><sub><b>Andreas Erhard</b></sub>](https://github.com/xelan) | [<img src="https://avatars.githubusercontent.com/u/32378535?v=4" width="100px"/><br/><sub><b>Matsumoto Toshi</b></sub>](https://github.com/toshi1127) | [<img src="https://avatars.githubusercontent.com/u/440634?v=4" width="100px"/><br/><sub><b>Carl Wilson</b></sub>](https://github.com/carlwilson) |
[<img src="https://avatars.githubusercontent.com/u/9918222?v=4" width="100px"/><br/><sub><b>LNAhri</b></sub>](https://github.com/LNAhri) | [<img src="https://avatars.githubusercontent.com/u/142796877?v=4" width="100px"/><br/><sub><b>vishal</b></sub>](https://github.com/vishal-at) | [<img src="https://avatars.githubusercontent.com/u/18169566?v=4" width="100px"/><br/><sub><b>Andreas Deininger</b></sub>](https://github.com/deining) | [<img src="https://avatars.githubusercontent.com/u/5825735?v=4" width="100px"/><br/><sub><b>Robert Raines</b></sub>](https://github.com/solintllc-robert) | [<img src="https://avatars.githubusercontent.com/u/316176?v=4" width="100px"/><br/><sub><b>Frank Anderson</b></sub>](https://github.com/frob) | |



Expand Down
23 changes: 22 additions & 1 deletion cmd/pdfcpu/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,18 @@ func parseFlags(cmd *command) {
}
initLogging(verbose, veryVerbose)
}

flag.Visit(func(f *flag.Flag) {
if f.Name == "bookmarks" || f.Name == "b" {
bookmarksSet = true
}
if f.Name == "offline" || f.Name == "off" || f.Name == "o" {
offlineSet = true
}
if f.Name == "optimize" || f.Name == "opt" {
optimizeSet = true
}
})
}

func validateConfigDirFlag() {
Expand Down Expand Up @@ -103,7 +115,7 @@ func validateConfigDirFlag() {
func ensureDefaultConfig() (*model.Configuration, error) {
validateConfigDirFlag()
if !types.MemberOf(model.ConfigPath, []string{"default", "disable"}) {
if err := model.EnsureDefaultConfigAt(model.ConfigPath); err != nil {
if err := model.EnsureDefaultConfigAt(model.ConfigPath, false); err != nil {
return nil, err
}
}
Expand Down Expand Up @@ -139,7 +151,16 @@ func (m commandMap) process(cmdPrefix string, command string) (string, error) {
conf.OwnerPW = opw
conf.UserPW = upw

if offlineSet {
conf.Offline = offline
}

if m[cmdStr].handler != nil {

if conf.Version != model.VersionStr && cmdStr != "reset" {
model.CheckConfigVersion(conf.Version)
}

m[cmdStr].handler(conf)
return command, nil
}
Expand Down
Loading
Loading