-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdfmarks.ps
35 lines (32 loc) · 1.69 KB
/
pdfmarks.ps
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
% Reference:
% Type name (Optional) The type of PDF object that this dictionary describes; if present, must be PageLabel for a page label dictionary.
% S name (Optional) The numbering style to be used for the numeric portion of each page label:
% D Decimal Arabic numerals
% R Uppercase Roman numerals
% r Lowercase Roman numerals
% A Uppercase letters (A to Z for the first 26 pages, AA to ZZ for the next 26, etc.)
% a Lowercase letters (a to z for the first 26 pages, aa to zz for the next 26, etc.)
% P string (Optional) The label prefix for page labels in this range.
% St integer (Optional) The value of the numeric portion for the first page label in the range. Subsequent pages will be numbered sequentially from this value, which must be greater than or equal to 1. Default value: 1.
% Example: renumber first 25 pages - push each by 10, and add prefix.
% [/_objdef {pl} /type /dict /OBJ pdfmark
% [{pl} <</Nums [0 << /P (Page ) /S /D /St 10 >> 25 << >>]>> /PUT pdfmark
% [{Catalog} <</PageLabels {pl}>> /PUT pdfmark
% Example: change first 16 pages to Roman numbering and then revert to Arabic numbering.
% /_objdef {pl} /type /dict /OBJ pdfmark
% [{pl} <</Nums [ 0 << /S /r >> 16 << /S /D >> ]>> /PUT pdfmark
% [{Catalog} <</PageLabels {pl}>> /PUT pdfmark
/do_renumbering {
[/_objdef {pl} /type /dict /OBJ pdfmark
[{pl} <</Nums [
Numberings {
/params exch def
/physical_page params 0 get def
/logical_page params 1 get def
/page_style params 2 get def
/page_label params 3 get def
physical_page 1 sub << page_style null ne { /S page_style } if page_label null ne { /P page_label } if /St logical_page >>
} forall
]>> /PUT pdfmark
[{Catalog} <</PageLabels {pl}>> /PUT pdfmark
} def