-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathcpdf.1
More file actions
2282 lines (2282 loc) · 67.7 KB
/
cpdf.1
File metadata and controls
2282 lines (2282 loc) · 67.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
.\" Automatically generated by Pandoc 3.9.0.2
.\"
.TH "CPDF" "1" "February 2026" ""
.SH NAME
cpdf \- PDF command line tools.
.SH SYNOPSIS
Simple operation:
.PP
\f[B]cpdf\f[R] [in.pdf] [operation] [options] [\-o out.pdf]
.PP
Operation on password\-protected file:
.PP
\f[B]cpdf\f[R] in.pdf [user=<password>] [owner=<password>] \&...
[\-o out.pdf]
.PP
Multiple operations, one after another:
.PP
\f[B]cpdf\f[R] [in.pdf] [operation] [options] \f[B]AND\f[R] [operation]
[options] \f[B]AND\f[R] \&...
[\-o out.pdf]
.SH DESCRIPTION
\f[B]Cpdf\f[R] is an AGPL\-licensed command line tool for processing PDF
files.
The rest of this document gives a brief description of each command line
operation and option.
The file cpdfmanual.pdf which you should find installed on your system
or otherwise at https://www.coherentpdf.com/cpdfmanual.pdf gives the
full usage details.
.PP
The sections in this document follow the chapters of cpdfmanual.pdf, for
easy cross\-referencing.
.SH 1. BASIC USAGE
.TP
\f[B]\-version\f[R]
Print the Cpdf version number.
.TP
\f[B]\-help, \(enhelp\f[R]
Gives links to sources of help.
.TP
\f[B]\-summary\f[R]
Lists and describes very briefly each command line option.
.TP
\f[B]\-o\f[R] <filename>
The output filename.
Beware of writing back to the input file.
.TP
\f[B]\-i\f[R] <filename>
Cpdf automatically treats any filename ending with .pdf (any case) as an
input PDF.
If your file does not end with .pdf, you can supply the file with
\f[B]\-i\f[R] instead.
.TP
\f[B]\-range\f[R] <range>
Gives the range of pages to be affected by an operation.
By default, all pages are affected.
The range may be specified without \f[B]\-range\f[R] simply by writing
it directly after the filename it relates to.
Example ranges: \(lq2\(rq \(lq1\-5\(rq \(lq1,2,3\-end\(rq \(lqodd\(rq
\(lqNOT1\-5\(rq.
See cpdfmanual.pdf for a full description.
.TP
\f[B]\-progress\f[R]
Show which operations and on which pages they are operating, as it
happens, on standard error.
.TP
\f[B]\-keep\-version\f[R]
Keep the PDF version of the input document even if features are used
which would otherwise make it increase.
.TP
\f[B]\-fast\f[R]
Presume ISO\-compliant content streams when processing page content.
This is faster, because it does not involve re\-parsing whole streams to
add content.
.TP
\f[B]\-idir\f[R] <path>
Add a whole directory of PDFs as inputs.
.TP
\f[B]\-idir\-only\-pdfs\f[R]
Restrict \f[B]\-idir\f[R] to only files ending in .pdf (any case).
Must appear before \f[B]\-idir\f[R].
.TP
\f[B]\-recrypt\f[R]
Re\-encrypt output files using the same encryption parameters (if any)
as the input file.
.TP
\f[B]\-decrypt\-force\f[R]
Allow the output file to be written decrypted even if permissions would
otherwise prevent it.
.TP
\f[B]\-stdout\f[R]
Write the output file to standard output instead of to a file with
\f[B]\-o\f[R].
.TP
\f[B]\-stdin\f[R]
Read the input PDF from standard input instead of from a named file.
.TP
\f[B]\-stdin\-user\f[R] <password>
Supply the user password for the PDF which is from standard input.
.TP
\f[B]\-stdin\-owner\f[R] <password>
Supply the owner password the the PDF which is from standard input.
.TP
\f[B]\-producer\f[R] <string>
Set the producer of the output file.
.TP
\f[B]\-creator\f[R] <string>
Set the creator of the output file.
.TP
\f[B]\-change\-id\f[R]
Change the PDF\(cqs ID field when writing the output file.
.TP
\f[B]\-l\f[R]
Linearize the PDF when writing.
Requires a linearizer to be supplied with \f[B]\-cpdflin\f[R].
.TP
\f[B]\-cpdflin\f[R] <path>
Give the path of an external linearizer.
For example, Qpdf.
.TP
\f[B]\-keep\-l\f[R]
Keep the linearization status (either linearized or not) of the input
file upon output.
Requires a linearizer to be supplied with \f[B]\-cpdflin\f[R].
.TP
\f[B]\-no\-preserve\-objstm\f[R]
Do not preserve existing object streams when writing the output file.
Note that \f[B]\-create\-objstm\f[R] and
\f[B]\-no\-preserve\-objstm\f[R] may be used together \- the effect is
then to redo all object streams.
.TP
\f[B]\-create\-objstm\f[R]
Create new object streams when writing the output file.
Note that \f[B]\-create\-objstm\f[R] and
\f[B]\-no\-preserve\-objstm\f[R] may be used together \- the effect is
then to redo all object streams.
.TP
\f[B]\-args\f[R] <filename>
Read command line arguments from the given file by direct textual
substitution into the command line, prior to any other processing.
.TP
\f[B]\-args\-json\f[R] <filename>
Read command line arguments from a JSON file consisting of a single
array of strings.
.TP
\f[B]\-utf8\f[R]
Read and write string data as UTF8.
Almost always the sensible option, and will become the default in a
future version.
.TP
\f[B]\-stripped\f[R]
Convert string output to 7 bit ASCII by dropping any high characters.
To be used with caution.
.TP
\f[B]\-raw\f[R]
Perform no processing on string outputs.
.TP
\f[B]\-gs\f[R] <path>
A very few of Cpdf\(cqs functions rely upon the \f[B]gs\f[R] command.
Its path may be supplied with \f[B]\-gs\f[R].
.TP
\f[B]\-gs\-malformed\f[R]
This option is used to allow Cpdf to call out to the \f[B]gs\f[R]
command to pre\-process badly malformed files as a last resort.
.TP
\f[B]\-gs\-malformed\-force\f[R]
See cpdfmanual.pdf for details of this fragile command.
.TP
\f[B]\-gs\-quiet\f[R]
Do not show the output of \f[B]gs\f[R] when used.
.TP
\f[B]\-error\-on\-malformed\f[R]
Do not attempt to reconstruct malformed files by any method, but exit
with an error.
.TP
\f[B]\-revisions\f[R]
Print the number of incremental\-update revisions in the file.
.TP
\f[B]\-revision\f[R] <n>
Extract a revision from the file.
Revision 1 is the latest, 2 the next back and so on.
Must come after file name.
.TP
\f[B]\-update\f[R]
Update a file incrementally.
As in \f[B]cpdf\f[R] \f[B]in.pdf\f[R] \&...
\-update \f[B]\-o in.pdf\f[R].
.SH 2. MERGING AND SPLITTING
.SS Merging
\f[B]cpdf \-merge in1.pdf\f[R] [<range>] \f[B]in2.pdf\f[R] [<range>]
[<more names/ranges>] [\-collate] [\-collate\-n <n>]
[\-retain\-numbering] [\-merge\-add\-bookmarks
[\-merge\-add\-bookmarks\-use\-titles]] [\-remove\-duplicate\-fonts]
[\-process\-struct\-trees] [\-subformat <subformat>] \f[B]\-o
out.pdf\f[R]
.PP
The \f[B]\-merge\f[R] operation allows the merging of several files into
one.
Ranges can be used to select only a subset of pages from each input file
in the output.
The output file consists of the concatenation of all the input pages in
the order specified on the command line.
Actually, the \f[B]\-merge\f[R] can be omitted, since this is the
default operation of Cpdf.
.TP
\f[B]\-collate\f[R]
Instead of ordinary operation, take the first page from the first
document, then the first from the second and so on.
Then the second page from the first document and on until all pages are
exhausted.
.TP
\f[B]\-collate\-n\f[R] <n>
Like \f[B]\-collate\f[R], but in chunks of more than one page.
.TP
\f[B]\-retain\-numbering\f[R]
Keep the page numbering of each input file intact, rather than
renumbering the pages in the output document beginning at 1.
.TP
\f[B]\-merge\-add\-bookmarks [\-merge\-add\-bookmarks\-use\-titles]\f[R]
Add a top\-level bookmark for each file, using the filename.
The option \f[B]\-merge\-add\-bookmarks\-use\-titles\f[R], when used in
conjunction with \f[B]\-merge\-add\-bookmarks\f[R], uses the titles from
document metadata instead.
.TP
\f[B]\-remove\-duplicate\-fonts\f[R]
Ensures that fonts used in more than one input appear only once in the
output.
.TP
\f[B]\-process\-struct\-trees\f[R]
Merge input structure trees in the output.
.TP
\f[B]\-subformat\f[R] <subformat>
If \f[B]\-subformat\f[R] \(lqPDF/UA\-2\(rq is given, together with
\f[B]\-process\-struct\-trees\f[R], Cpdf will add a top\-level Document
structure tree element.
.SS Portfolios
A PDF portfolio is a special kind of PDF which contains other documents
(PDF and otherwise) within it.
Support is mostly limited to Adobe products at time of writing.
.PP
\f[B]cpdf\f[R] \f[B]\-portfolio\f[R] \f[B]in.pdf\f[R] \-pf <filename>
[\-pfd <string>] [\-pfr <relationship>] [\-pf \&...]
\f[B]\-o out.pdf\f[R]
.PP
The input \f[B]in.pdf\f[R] here is the main file.
You can build a blank one with \f[B]\-create\-pdf\f[R].
.TP
\f[B]\-pf\f[R] <filename>
The filename for each file to include in the portfolio.
.TP
\f[B]\-pfd\f[R] <description>
The description for the file (must appear after \f[B]\-pf\f[R]).
.TP
\f[B]\-pfr\f[R] <relationship>
The so\-called relationship for the file (must appear after
\f[B]\-pf\f[R]).
.SS Splitting
We can split an input PDF into its constituent pages, and output one PDF
for each page or each chunk of pages.
.PP
\f[B]cpdf \-split in.pdf\f[R] [\-chunk <n>] [\-process\-struct\-trees]
[\-utf8] \f[B]\-o <format>\f[R]
.PP
The output format has many options (see cpdfmanual.pdf for details).
But the simplest is just to number the outputs in sequence.
For example \f[B]cpdf in.pdf \-o out%%%.pdf\f[R] will produce
out001.pdf, out002.pdf and so on.
.TP
\f[B]\-chunk\f[R] <n>
Choose a chunk size other than 1.
.TP
\f[B]\-process\-struct\-trees\f[R]
Split the input document\(cqs structure tree into the output documents.
.TP
\f[B]\-utf8\f[R]
This option may be required in the case of some output formats.
See cpdfmanual.pdf for details.
.SS Splitting on bookmarks
\f[B]cpdf \-split\-bookmarks <level> in.pdf\f[R]
[\-process\-struct\-trees] [\-utf8] \f[B]\-o <format>\f[R]
.PP
Split on bookmark boundaries at a given level, instead of splitting on
each page.
Level 0 is top level, level 1 next, and so on.
See above for format details.
.TP
\f[B]\-process\-struct\-trees\f[R]
Split the input document\(cqs structure tree into the output documents.
.TP
\f[B]\-utf8\f[R]
This option may be required in the case of some output formats.
See cpdfmanual.pdf for details.
.SS Splitting to a given size
\f[B]cpdf \-split\-max <n> in.pdf\f[R] [\-process\-struct\-trees]
[\-utf8] \f[B]\-o <format> \f[R]
.PP
Split the file, if possible, to a maximum file size (in bytes) for each
output PDF.
See above for format details.
.TP
\f[B]\-process\-struct\-trees\f[R]
Split the input document\(cqs structure tree into the output documents.
.TP
\f[B]\-utf8\f[R]
This option may be required in the case of some output formats.
See cpdfmanual.pdf for details.
.SS Interleaved splitting
We can use \f[B]\-spray\f[R] to write the split pages to more than one
named output file.
When Cpdf runs out of output files, it adds the next page to the first
output file, and so on until all input pages are exhausted.
.PP
\f[B]cpdf \-spray in.pdf\f[R] [\-process\-struct\-trees] [\-utf8]
\f[B]\-o a.pdf\f[R] [\-o b.pdf [\-o \&...]]
.TP
\f[B]\-process\-struct\-trees\f[R]
Split the input document\(cqs structure tree into the output documents.
.TP
\f[B]\-utf8\f[R]
This option may be required in the case of some output formats.
See cpdfmanual.pdf for details.
.SH 3. PAGES
\f[B]cpdf \-scale\-page \(lq<x scale> <y scale>\(rq\f[R]
\f[B]in.pdf\f[R] [<range>] [\-fast] [<position>] \f[B]\-o out.pdf\f[R]
.PP
Scale pages in the given range by the given factor e.g \(lq2 2\(rq.
See Chapter 8 for information on positions.
.PP
\f[B]cpdf \-scale\-to\-fit \(lq<x size> <y size>\(rq\f[R]
\f[B]in.pdf\f[R] [<range>] [\-fast] [\-prerotate] [<position>]
[\-scale\-to\-fit\-scale <scale>] [\-scale\-to\-fit\-rotate\-clockwise]
[\-scale\-to\-fit\-rotate\-anticlockwise] \f[B]\-o out.pdf\f[R]
.PP
Scale pages in the given range to fit the given size e.g \(lqa4paper\(rq
or \(lq10in 7in\(rq, without altering the aspect ratio.
By default the content will be centered on the new page.
See Chapter 8 for information on positions.
.TP
\f[B]\-scale\-to\-fit\-scale\f[R] <n>
Scale to a proportion of the available area, instead of filling it.
For example 0.9 for 90 percent.
.TP
\f[B]\-scale\-to\-fit\-rotate\-clockwise \-scale\-to\-fit\-rotate\-anticlockwise\f[R]
Automatically rotate page to maximise use of area.
.TP
\f[B]\-prerotate\f[R]
Remove any viewing rotation before beginning.
.PP
\f[B]cpdf \-stretch \(lq<x size> <y size>\(rq\f[R] \f[B]in.pdf\f[R]
[<range>] [\-fast] \f[B]\-o out.pdf\f[R]
.PP
Scale pages without regard to aspect ratio.
.PP
\f[B]cpdf \-center\-to\-fit \(lq<x size> <y size>\(rq\f[R]
\f[B]in.pdf\f[R] [<range>] [\-fast] \f[B]\-o out.pdf\f[R]
.PP
Center each page on a new page size, without scaling it.
.PP
\f[B]cpdf \-scale\-contents <scale>\f[R] \f[B]in.pdf\f[R] [<range>]
[<position>] [\-fast] \f[B]\-o out.pdf\f[R]
.PP
Scale the content of pages by a given factor, without changing the size
of the page.
See the end of this chapter for position.
.PP
\f[B]cpdf \-shift \(lq<shift x> <shift y>\(rq\f[R] \f[B]in.pdf\f[R]
[<range>] [\-fast] \f[B]\-o out.pdf\f[R]
.PP
Shift the content of pages by a given displacement.
.PP
\f[B]cpdf \-shift\-boxes \(lq<shift x> <shift y>\(rq\f[R]
\f[B]in.pdf\f[R] [<range>] \f[B]\-o out.pdf\f[R]
.PP
Shift the boxes of a page by a given displacement, without moving the
content.
.PP
\f[B]cpdf \-rotate <angle> in.pdf\f[R] [<range>] \f[B]\-o out.pdf\f[R]
.PP
Change the PDF viewing rotation of pages to 0, 90, 180 or 270 degrees
clockwise.
.PP
\f[B]cpdf \-rotateby <angle> in.pdf\f[R] [<range>] \f[B]\-o out.pdf\f[R]
.PP
Change the PDF viewing rotation of pages by 0, 90, 180 or 270 degrees
clockwise.
.PP
\f[B]cpdf \-upright\f[R] \f[B]in.pdf\f[R] [<range>] [\-fast] \f[B]\-o
out.pdf\f[R]
.PP
The \f[B]\-upright\f[R] operation does whatever combination of
\f[B]\-rotate\f[R] and \f[B]\-rotate\-contents\f[R] is required to
change the rotation of the document to zero without altering its
appearance.
In addition, it makes sure the media box has its origin at (0,0),
changing other boxes to compensate.
.PP
\f[B]cpdf \-rotate\-contents <angle>\f[R] \f[B]in.pdf\f[R] [<range>]
[\-fast] \f[B]\-o out.pdf\f[R]
.PP
Rotates the content of the page around its center point by the given
angle.
.PP
\f[B]cpdf \-hflip\f[R] \f[B]in.pdf\f[R] [<range>] [\-fast] \f[B]\-o
out.pdf\f[R]
.PP
Flip page content horizontally.
.PP
\f[B]cpdf \-vflip\f[R] \f[B]in.pdf\f[R] [<range>] [\-fast] \f[B]\-o
out.pdf\f[R]
.PP
Flip page content vertically.
.PP
\f[B]cpdf \-[media | crop | art | trim | bleed]box <boxspec> in.pdf\f[R]
[<range>] \f[B]\-o out.pdf\f[R]
.PP
Set the media, crop, art, trim or bleed box.
For example \f[B]\-cropbox \(lq50 50 300 200\(rq\f[R] sets minx 50, miny
50, width 300, height 200.
To use absolute numbers instead of width and height, prefix with a
question mark, writing \f[B]\(lq?50 50 350 250\(rq\f[R] instead.
.PP
\f[B]cpdf \-remove\-[crop | art | trim | bleed]box in.pdf\f[R] [<range>]
\f[B]\-o out.pdf\f[R]
.PP
Remove a crop, art, trim or bleed box from pages.
.PP
\f[B]cpdf \-frombox <boxname> \-tobox <boxname>\f[R] \f[B]in.pdf\f[R]
[<range>] [\-mediabox\-if\-missing] \f[B]\-o out.pdf\f[R]
.PP
Copy a box to another.
For example from \f[B]/TrimBox\f[R] to \f[B]/CropBox\f[R].
.TP
\f[B]\-mediabox\-if\-missing\f[R]
Use media box, rather than failing, if the \f[B]\-frombox\f[R] is
missing.
.PP
\f[B]cpdf \-hard\-box <boxname>\f[R] \f[B]in.pdf\f[R] [<range>] [\-fast]
[\-mediabox\-if\-missing] \f[B]\-o out.pdf\f[R]
.PP
Create a hard box for a given box name \- that is to say, one which
clips its content.
.PP
\f[B]cpdf \-show\-boxes\f[R] \f[B]in.pdf\f[R] [<range>] [\-fast]
\f[B]\-o out.pdf\f[R]
.PP
Show the media, crop, art, trim, and bleed boxes in Red, Green, Blue,
Orange and Pink respectively.
.PP
\f[B]cpdf \-trim\-marks\f[R] \f[B]in.pdf\f[R] [<range>] [\-fast]
\f[B]\-o out.pdf\f[R]
.PP
Add trim marks to a PDF.
The trim box must be present.
.SH 4. ENCRYPTION AND DECRYPTION
\f[B]cpdf \-encrypt <method> [\-pw=]<owner password> [\-pw=]<user
password>\f[R] \f[B]in.pdf\f[R] [\-no\-encrypt\-metadata] <permissions>
\f[B]\-o out.pdf\f[R]
.PP
Encrypt a document given the method (e.g \f[B]AES256ISO\f[R] for modern
usage), owner and user passwords, and optionally permissions.
E.g \f[B]cpdf \-encrypt AES256ISO secret \(lq\(rq in.pdf \-o
out.pdf\f[R].
.TP
\f[B]\-no\-encrypt\-metadata\f[R]
Do not encrypt metadata (AES encryption only).
.TP
\f[B]\-pw=\f[R]<password>
Useful if a password may begin with a dash.
.PP
Permissions:
.TP
\f[B]\-no\-edit\f[R]
Cannot change the document.
.TP
\f[B]\-no\-print\f[R]
Cannot print the document.
.TP
\f[B]\-no\-copy\f[R]
Cannot select or copy text or graphics.
.TP
\f[B]\-no\-annot\f[R]
Cannot add or change form fields or annotations.
.TP
\f[B]\-no\-forms\f[R]
Cannot edit form fields.
.TP
\f[B]\-no\-extract\f[R]
Cannot extract text or graphics.
.TP
\f[B]\-no\-assemble\f[R]
Cannot, for example, merge files.
.TP
\f[B]\-no\-hq\-print\f[R]
Cannot print high\-quality.
.PP
Note: Adobe Acrobat and Adobe Reader may show slightly different
permissions in info dialogues \(en this is a result of policy changes
and not a bug in Cpdf.
You may need to experiment.
.TP
\f[B]cpdf \-decrypt\f[R] \f[B]in.pdf owner=<owner password>\f[R] [\-decrypt\-force] \f[B]\-o out.pdf\f[R]
Decrypt a document, given its owner password.
.TP
\f[B]\-decrypt\-force\f[R]
Decrypt even without the owner password, using just the user password.
The user password is often blank.
.SH 5. COMPRESSION
\f[B]cpdf \-decompress\f[R] \f[B]in.pdf\f[R] [\-just\-content]
[\-jbig2dec <path>] \f[B]\-o out.pdf\f[R]
.PP
Decompress the streams in a PDF file, for instance to manually inspect
it.
.TP
\f[B]\-just\-content\f[R]
Only decompress page content streams.
.TP
\f[B]\-jbig2dec\f[R] <path>
Give the path to the jbig2dec program which Cpdf uses, if available, to
decompress JBIG2 streams.
.PP
\f[B]cpdf \-compress in.pdf \-o out.pdf\f[R]
.PP
Compress any streams which are uncompressed using the FlateDecode
method, with the exception of metadata streams.
.PP
\f[B]cpdf \-squeeze in.pdf\f[R] [\-squeeze\-log\-to <filename>]
[\-squeeze\-no\-pagedata] \f[B]\-o out.pdf\f[R]
.PP
Squeeze a file by coalescing like objects, and various other methods.
.TP
\f[B]\-squeeze\-log\-to\f[R] <filename>
Write the squeeze log to file rather than standard output.
.TP
\f[B]\-squeeze\-no\-pagedata\f[R]
Avoid processing page data, making the squeeze process much faster at
the cost of a little compression.
.PP
\f[B]cpdf \-remove\-article\-threads in.pdf \-o out.pdf\f[R]
.PP
Remove article threads.
.PP
\f[B]cpdf \-remove\-page\-piece in.pdf \-o out.pdf\f[R]
.PP
Remove page piece information.
.PP
\f[B]cpdf \-remove\-web\-capture in.pdf \-o out.pdf\f[R]
.PP
Remove web capture data.
.PP
\f[B]cpdf \-remove\-procsets in.pdf \-o out.pdf\f[R]
.PP
Remove ProcSets, a now\-irrelevant data structure from early PDFs.
.PP
\f[B]cpdf \-remove\-output\-intents in.pdf \-o out.pdf\f[R]
.PP
Remove output intents, a colour\-matching system for documents intended
to be printed.
.SH 6. BOOKMARKS
\f[B]cpdf \-list\-bookmarks\f[R] \f[B]in.pdf\f[R] [\-utf8]
.PP
Print bookmark data to standard output.
The data includes level, title, page number linked to, and full link
data.
Use \f[B]\-utf8\f[R] always.
For example:
.IP
.EX
0 \(dqPart 1\(dq 1 open
1 \(dqPart 1A\(dq 2 \(dq[2 /XYZ 200 400 null]\(dq
1 \(dqPart 1B\(dq 3
0 \(dqPart 2\(dq 4
1 \(dqPart 2a\(dq 5
.EE
.PP
\f[B]cpdf \-list\-bookmarks\-json\f[R] \f[B]in.pdf\f[R]
[\-preserve\-actions]
.PP
Print bookmark data to standard output in JSON format instead.
Here is a single entry in the JSON array of bookmarks:
.IP
.EX
{ \(dqlevel\(dq: 0,
\(dqtext\(dq: \(dq1 Basic Usage\(dq,
\(dqpage\(dq: 17,
\(dqopen\(dq: false,
\(dqtarget\(dq:
[ { \(dqI\(dq: 17 },
{ \(dqN\(dq: \(dq/XYZ\(dq },
{ \(dqF\(dq: 85.039 },
{ \(dqF\(dq: 609.307 },
null ]
\(dqcolour\(dq: [ 0.0, 0.0, 0.0 ],
\(dqitalic\(dq: false,
\(dqbold\(dq: false
}
.EE
.TP
\f[B]\-preserve\-actions\f[R]
Instead of resolving complex destinations types to simple ones, keep the
originals.
.PP
\f[B]cpdf \-remove\-bookmarks in.pdf \-o out.pdf\f[R]
.PP
Remove all bookmarks from a PDF.
.PP
\f[B]cpdf \-add\-bookmarks <filename> in.pdf \-o out.pdf\f[R]
.PP
Add bookmarks, given an old\-style bookmark file.
.PP
\f[B]cpdf \-add\-bookmarks\-json <filename> in.pdf \-o out.pdf\f[R]
.PP
Add bookmarks, given a new\-style JSON bookmark file.
.PP
\f[B]cpdf \-bookmarks\-open\-to\-level <n> in.pdf \-o out.pdf\f[R]
.PP
Set all bookmarks up to and including a given level to be open.
.PP
\f[B]cpdf \-table\-of\-contents\f[R] \f[B]in.pdf\f[R] [\-toc\-title
<string>] [\-toc\-no\-bookmark] [\-toc\-dot\-leaders] [\-font <font>]
[\-font\-size <n>] [\-embed\-std14 <path>] [\-process\-struct\-trees]
[\-subformat <subformat>] \f[B]\-o out.pdf\f[R]
.PP
Generate a typeset table of contents from existing bookmarks, adding it
to the beginning of the document.
.TP
\f[B]\-toc\-title\f[R] <string>
Title (default is \(lqTable of Contents\(rq).
.TP
\f[B]\-toc\-no\-bookmark\f[R]
Do not add an entry for the new table of contents in the document\(cqs
bookmarks.
.TP
\f[B]\-toc\-dot\-leaders\f[R]
Add dot leaders.
.TP
\f[B]\-font\f[R] <font>
Give the font (default Times Roman).
.TP
\f[B]\-font\-size\f[R] <n>
Give the font size (default 12pt).
.TP
\f[B]\-embed\-std14\f[R]
Embed standard 14 fonts given their path (see cpdfmanual.pdf for
details).
.TP
\f[B]\-process\-struct\-trees\f[R]
Create a structure tree for the new table of contents and merge it with
the document\(cqs.
.TP
\f[B]\-subformat\f[R] <subformat>
Add \f[B]\-subformat \(lqPDF/UA\-2\(rq\f[R] when adding a table of
contents to a PDF/UA\-2 file to keep compatibility.
.SH 7. PRESENTATIONS
\f[B]cpdf \-presentation in.pdf\f[R] [<range>] \f[B]\-o out.pdf\f[R]
[\-trans <transition\-name>] [\-duration <float>] [\-vertical]
[\-outward] [\-direction <n>] [\-effect\-duration <float>]
.PP
Make a slide\-show presentation from a PDF.
.PP
\f[B]\-trans\f[R] <transition>
.PP
The transition style, one of \f[B]Split\f[R], \f[B]Blinds\f[R],
\f[B]Box\f[R], \f[B]Wipe\f[R], \f[B]Dissolve\f[R], \f[B]Glitter\f[R].
.TP
\f[B]\-duration\f[R] <n>
Time in seconds before presentation advances (default: no automatic
advancement).
.TP
\f[B]\-vertical\f[R]
Select vertical blinds for transition type Blinds.
.TP
\f[B]\-outward\f[R]
Select outward sweep for transition type Box.
.TP
\f[B]\-direction\f[R] <n>
Direction for Wipe and Glitter styles.
See cpdfmanual.pdf for full information.
.TP
\f[B]\-effect\-duration\f[R] <n>
Length in seconds of the transition itself.
.SH 8. TEXT AND STAMPS
\f[B]cpdf [\-stamp\-on | \-stamp\-under] stamp.pdf\f[R] \f[B]in.pdf\f[R]
[<range>] [\-scale\-stamp\-to\-fit] [<positioning command>]
[\-relative\-to\-[crop|trim|art|bleed]box] [\-process\-struct\-trees]
[\-fast] \f[B]\-o out.pdf\f[R]
.PP
Stamp a one\-page PDF over or under each page in the given range.
The positioning commands described later in this chapter may be used to
choose where to stamp it (default, bottom left of media box).
.TP
\f[B]\-scale\-stamp\-to\-fit\f[R]
Scale the stamp to fit the page before applying it.
.TP
\f[B]\-relative\-to\-[crop|trim|art|bleed]box\f[R]
Take the positioning command relative to the given box rather than the
media box.
.TP
\f[B]\-process\-struct\-trees\f[R]
Maintain tagged PDF.
The main file will keep its structure; the stamp will be marked as an
artifact.
.PP
\f[B]cpdf \-combine\-pages over.pdf under.pdf\f[R] [\-fast]
[\-prerotate] [\-no\-warn\-rotate] [\-process\-struct\-trees]
[\-underneath] [\-stamp\-scale\-to\-fit] \f[B]\-o out.pdf\f[R]
.PP
Combine the pages of two PDFs, page 1 of the first with page 1 of the
second and so on.
.TP
\f[B]\-prerotate\f[R]
Remove any rotation differences between the files before combining.
.TP
\f[B]\-no\-warn\-rotate\f[R]
Do not warn of unresolved rotation differences.
.TP
\f[B]\-underneath\f[R]
Reverse the order of \(lqover\(rq and \(lqunder\(rq files.
.TP
\f[B]\-process\-struct\-trees\f[R]
Maintain tagged PDF.
The \(lqunder\(rq file will keep its structure; the \(lqover\(rq file
will be marked as an artifact.
.PP
\f[B]cpdf [\-add\-text <string> | \-add\-rectangle \(lq<x size> <y
size>\(rq]\f[R] [\-font <fontname>] [\-font\-size <n>] [\-load\-ttf
<name>=<filename>] [\-embed\-std14 <path>] [\-color <color>]
[\-line\-spacing <n>] [\-outline] [\-linewidth <n>] [\-underneath]
[\-relative\-to\-[crop|trim|art|bleed]box] [\-prerotate]
[\-no\-warn\-rotate] [\-bates <n>] [\-bates\-at\-range <n>]
[\-bates\-pad\-to <n>] [\-opacity <n>] [\-midline] [\-topline]
[\-text\-[90|180|270]] [\-fast] [\-process\-struct\-trees]
\f[B]in.pdf\f[R] [<range>] \f[B]\-o out.pdf\f[R]
.PP
Add text to a PDF.
Various special codes for page numbers or time and date may be used.
For example:
.IP
.EX
%Page Page number in arabic notation (1, 2, 3. . . )
%PageDiv2 Page number in arabic notation divided by two
%roman Page number in lower\-case roman notation (i, ii, iii. . . )
%Roman Page number in upper\-case roman notation (I, II, III. . . )
%EndPage Last page of document in arabic notation
%Label The page label of the page
%EndLabel The page label of the last page
%filename The full file name of the input document
%URL[text|URL] Add text, which links to URL (does not work for diagonal text)
%Bookmark<n> Bookmark text at level n (0, 1, 2, 3, 4)
%Bates Bates number
.EE
.PP
And date and time formats:
.IP
.EX
%a Abbreviated weekday name (Sun, Mon etc.)
%A Full weekday name (Sunday, Monday etc.)
%b Abbreviated month name (Jan, Feb etc.)
%B Full month name (January, February etc.)
%d Day of the month (01\-31)
%e Day of the month (1\-31)
%H Hour in 24\-hour clock (00\-23)
%I Hour in 12\-hour clock (01\-12)
%j Day of the year (001\-366)
%m Month of the year (01\-12)
%M Minute of the hour (00\-59)
%p \(dqa.m\(dq or \(dqp.m\(dq
%S Second of the minute (00\-61)
%T Same as %H:%M:%S
%u Weekday (1\-7, 1 = Sunday)
%w Weekday (0\-6, 0 = Sunday)
%Y Year (0000\-9999)
%% The % character
.EE
.PP
\(rsn may be used to demarcate multiple lines.
.TP
\f[B]\-font\f[R] <font>
Give the font (default Times Roman).
Options are:
.IP
.EX
Times\-Roman
Times\-Bold
Times\-Italic
Times\-BoldItalic
Helvetica
Helvetica\-Bold
Helvetica\-Oblique
Helvetica\-BoldOblique
Courier
Courier\-Bold
Courier\-Oblique
Courier\-BoldOblique
.EE
.TP
\f[B]\-font\-size\f[R] <n>
Give the font size (default 12pt).
.TP
\f[B]\-load\-ttf\f[R] <name>=<filename>
Load a truetype font, and give it name which may be used with \-font.
For example \f[B]\-load\-ttf A=NotoSans\-Black.ttf\f[R].
.TP
\f[B]\-embed\-std14\f[R] <path>
Embed the standard 14 fonts given the path to the URW Base35 free fonts.
.TP
\f[B]\-color\f[R] <color>
Choose the text colour using one (Grey), three (RGB), or four (CMYK)
numbers from 0\-1.
E.g \f[B]\-color \(lq0.5 0.4 0.5\(rq\f[R].
.TP
\f[B]\-line\-spacing\f[R] <n>
Set the spacing for multi\-line text (default 1).
.TP
\f[B]\-outline\f[R]
Use outline text.
.TP
\f[B]\-linewidth\f[R] <n>
Line width for outline text.
.TP
\f[B]\-underneath\f[R]
Put the text underneath the page instead of on top of the page.
.TP
\f[B]\-relative\-to\-[crop|trim|art|bleed]box\f[R]
Positions are relative to the given box, rather than the media box.
.TP
\f[B]\-prerotate\f[R]
Remove any viewing rotation before adding text.
.TP
\f[B]\-no\-warn\-rotate\f[R]
Do not warn of unresolved viewing rotation.
.TP
\f[B]\-bates\f[R] <n>
Set the bates number for use with \f[B]%Bates\f[R].
.TP
\f[B]\-bates\-at\-range\f[R] <n>
Set the bates number for the first page in the range.
.TP
\f[B]\-bates\-pad\-to\f[R] <n>
Pad bates numbers to a given number of leading zeros.
.TP
\f[B]\-opacity\f[R] <n>
Set text opacity.
Wholly opaque is 1, wholly transparent is 0.
.TP
\f[B]\-midline\f[R]
Position is relative to the midline of text rather than the baseline.
.TP
\f[B]\-topline\f[R]
Position is relative to the topline of text rather than the baseline.
.TP
\f[B]\-process\-struct\-trees\f[R]
Maintain tagged PDF, for example with PDF/UA.
The main file will keep its structure; the stamped text will be marked
as an artifact.
.PP
Positioning commands:
.TP
\f[B]\-pos\-left\f[R] \(lq<x> <y>\(rq
Position the left of the baseline of the text at (x, y).
.TP
\f[B]\-pos\-center\f[R] \(lq<x> <y>\(rq
Position the center of the baseline of the text at (x, y).
.TP
\f[B]\-pos\-right\f[R] \(lq<x> <y>\(rq
Position the right of the baseline of the text at (x, y).
.TP
\f[B]\-top\f[R] <n>
Position the baseline of the text n pts from the top middle of the page.
.TP
\f[B]\-topleft\f[R] <n>
Position the left of the baseline of the text n pts below and right of
the top left of the page.
.TP
\f[B]\-topleft\f[R] \(lq<x> <y>\(rq
Position the left of the baseline of the text y pts below and x pts
right of the top left of the page.
.TP
\f[B]\-topright\f[R] <n>
Position the right of the baseline of the text n pts below and left of
the top right of the page.
.TP
\f[B]\-topright\f[R] \(lq<x> <y>\(rq
Position the right of the baseline of the text y pts below and x pts
left of the top right of the page.
.TP
\f[B]\-left\f[R] <n>
Position the left of the baseline of the text n pts right of the left
middle of the page.
.TP
\f[B]\-bottomleft\f[R] <n>
Position the left of the baseline of the text n pts up and right of the
bottom left of the page.
.TP
\f[B]\-bottomleft\f[R] \(lq<x> <y>\(rq
Position the left of the baseline of the text y pts up and x pts right
of the bottom left of the page.
.TP
\f[B]\-bottom\f[R] <n>
Position the center of the baseline of the text n pts up from the bottom
middle of the page.
.TP
\f[B]\-bottomright\f[R] <n>
Position the right of the baseline of the text n pts up and left from
the bottom right of the page.
.TP
\f[B]\-bottomright\f[R] \(lq<x> <y>\(rq
Position the right of the baseline of the text y pts up and x pts left
from the bottom right of the page.
.TP
\f[B]\-right\f[R] <n>
Position the right of the baseline of the text n pts left of the center
right of the page.
.TP
\f[B]\-diagonal\f[R]
Position text diagonally, bottom left to top right.
.TP
\f[B]\-reverse\-diagonal\f[R]
Position text diagonally, top left to bottom right.
.TP
\f[B]\-center\f[R]
Position text centered on the page.
.TP
\f[B]\-text\-90\f[R]
Rotate text 90 degrees.
.TP
\f[B]\-text\-180\f[R]
Rotate text 180 degrees.
.TP
\f[B]\-text\-270\f[R]
Rotate text 270 degrees.
.TP
\f[B]\-justify\-left\f[R]
Set left justification for multi\-line text.
Default depends upon position.
.TP
\f[B]\-justify\-right\f[R]
Set right justification for multi\-line text.
Default depends upon position.
.TP
\f[B]\-justify\-center\f[R]
Set center justification for multi\-line text.
Default depends upon position.
.TP
\f[B]\-url\-border\f[R]
Show the border for %URL text specials.
.PP
\f[B]cpdf \-remove\-text in.pdf\f[R] [<range>] \f[B]\-o out.pdf\f[R]
.PP
Remove text previously added by Cpdf.
.PP
\f[B]cpdf \-prepend\-content <content> in.pdf\f[R] [<range>] \f[B]\-o
out.pdf\f[R]
.PP
A low\-level operation to prepend raw content to the beginning of page
streams.
.PP
\f[B]cpdf \-postpend\-content <content> in.pdf\f[R] [<range>] \f[B]\-o
out.pdf\f[R]
.PP
A low\-level operation to postpend raw content to the end of page
streams.
.PP
\f[B]cpdf \-stamp\-as\-xobject stamp.pdf in.pdf\f[R] [<range>] \f[B]\-o
out.pdf\f[R]
.PP
A low\-level operation to add stamp.pdf as a Form XObject in the given
pages of a PDF and write to standard output its name.
.SH 9. MULTIPAGE FACILITIES
\f[B]cpdf [\-pad\-before | \-pad\-after] in.pdf\f[R] [<range>]
[\-pad\-with pad.pdf] \f[B]\-o out.pdf\f[R]
.PP
Add blank pages before or after each page in the given range.
.TP
\f[B]\-pad\-with\f[R] <filename>
Use a separate PDF to act as the padding.
.TP
\f[B]cpdf \-pad\-every <n> in.pdf\f[R] [\-pad\-with pad.pdf] \f[B]\-o out.pdf\f[R]
Add a blank page after every n pages.
.TP
\f[B]\-pad\-with\f[R] <filename>
Use a separate PDF to act as the padding.
.PP
\f[B]cpdf [\-pad\-multiple | \-pad\-multiple\-before]\f[R] [<n>]
\f[B]in.pdf \-o out.pdf\f[R]
.PP
Add as many blank pages as are required before or after the original
pages to make the file\(cqs length a multiple of the given number of
pages
.PP
\f[B]cpdf \-redact\f[R] \f[B]in.pdf\f[R] [<range>]
[\-process\-struct\-trees] \f[B]\-o out.pdf\f[R]
.PP
Remove the content of the pages in the given range entirely, including
annotations and any resources.
.TP
\f[B]\-process\-struct\-trees\f[R]
Process the document\(cqs structure tree to remove any parts which are
marked as relating to the now\-redacted pages.
.PP
\f[B]cpdf [\-impose <pagesize> | impose\-xy \(lq<x> <y>\(rq]\f[R]
\f[B]in.pdf\f[R] [\-impose\-columns] [\-impose\-rtl] [\-impose\-btt]