@@ -25,47 +25,50 @@ Usage:
2525
2626The commands are:
2727
28- annotations list, remove page annotations
29- attachments list, add, remove, extract embedded file attachments
30- booklet arrange pages onto larger sheets of paper to make a booklet or zine
31- bookmarks list, import, export, remove bookmarks
32- boxes list, add, remove page boundaries for selected pages
33- changeopw change owner password
34- changeupw change user password
35- collect create custom sequence of selected pages
36- config print configuration
37- create create PDF content including forms via JSON
38- crop set cropbox for selected pages
39- cut custom cut pages horizontally or vertically
40- decrypt remove password protection
41- encrypt set password protection
42- extract extract images, fonts, content, pages or metadata
43- fonts install, list supported fonts, create cheat sheets
44- form list, remove fields, lock, unlock, reset, export, fill form via JSON or CSV
45- grid rearrange pages or images for enhanced browsing experience
46- images list images for selected pages
47- import import/convert images to PDF
48- info print file info
49- keywords list, add, remove keywords
50- merge concatenate PDFs
51- ndown cut selected pages into n pages symmetrically
52- nup rearrange pages or images for reduced number of pages
53- optimize optimize PDF by getting rid of redundant page resources
54- pages insert, remove selected pages
55- paper print list of supported paper sizes
56- permissions list, set user access permissions
57- portfolio list, add, remove, extract portfolio entries with optional description
58- poster cut selected pages into poster using paper size or dimensions
59- properties list, add, remove document properties
60- resize scale selected pages
61- rotate rotate selected pages
62- selectedpages print definition of the -pages flag
63- split split up a PDF by span or bookmark
64- stamp add, remove, update Unicode text, image or PDF stamps for selected pages
65- trim create trimmed version of selected pages
66- validate validate PDF against PDF 32000-1:2008 (PDF 1.7)
67- version print version
68- watermark add, remove, update Unicode text, image or PDF watermarks for selected pages
28+ annotations list, remove page annotations
29+ attachments list, add, remove, extract embedded file attachments
30+ booklet arrange pages onto larger sheets of paper to make a booklet or zine
31+ bookmarks list, import, export, remove bookmarks
32+ boxes list, add, remove page boundaries for selected pages
33+ changeopw change owner password
34+ changeupw change user password
35+ collect create custom sequence of selected pages
36+ config print configuration
37+ create create PDF content including forms via JSON
38+ crop set cropbox for selected pages
39+ cut custom cut pages horizontally or vertically
40+ decrypt remove password protection
41+ encrypt set password protection
42+ extract extract images, fonts, content, pages or metadata
43+ fonts install, list supported fonts, create cheat sheets
44+ form list, remove fields, lock, unlock, reset, export, fill form via JSON or CSV
45+ grid rearrange pages or images for enhanced browsing experience
46+ images list images for selected pages
47+ import import/convert images to PDF
48+ info print file info
49+ keywords list, add, remove keywords
50+ merge concatenate PDFs
51+ ndown cut selected pages into n pages symmetrically
52+ nup rearrange pages or images for reduced number of pages
53+ optimize optimize PDF by getting rid of redundant page resources
54+ pagelayout list, set, reset page layout for opened document
55+ pagemode list, set, reset page mode for opened document
56+ pages insert, remove selected pages
57+ paper print list of supported paper sizes
58+ permissions list, set user access permissions
59+ portfolio list, add, remove, extract portfolio entries with optional description
60+ poster cut selected pages into poster using paper size or dimensions
61+ properties list, add, remove document properties
62+ resize scale selected pages
63+ rotate rotate selected pages
64+ selectedpages print definition of the -pages flag
65+ split split up a PDF by span or bookmark
66+ stamp add, remove, update Unicode text, image or PDF stamps for selected pages
67+ trim create trimmed version of selected pages
68+ validate validate PDF against PDF 32000-1:2008 (PDF 1.7)
69+ version print version
70+ viewpreferences list, set, reset viewing preferences for opened document
71+ watermark add, remove, update Unicode text, image or PDF watermarks for selected pages
6972
7073 All instantly recognizable command prefixes are supported eg. val for validation
7174 One letter Unix style abbreviations supported for flags and command parameters.
@@ -1322,4 +1325,147 @@ description ... scalefactor, dimensions, formsize, enforce, border, bgcolor
13221325 outFile ... output PDF file
13231326 outFileJSON ... output PDF file
13241327`
1328+
1329+ usagePageLayoutList = "pdfcpu pagelayout list inFile"
1330+ usagePageLayoutSet = "pdfcpu pagelayout set inFile value"
1331+ usagePageLayoutReset = "pdfcpu pagelayout reset inFile" + generalFlags
1332+
1333+ usagePageLayout = "usage: " + usagePageLayoutList +
1334+ "\n " + usagePageLayoutSet +
1335+ "\n " + usagePageLayoutReset
1336+
1337+ usageLongPageLayout = `Manage the page layout which shall be used when the document is opened:
1338+
1339+ inFile ... input PDF file
1340+ value ... one of:
1341+
1342+ SinglePage ... Display one page at a time (default)
1343+ TwoColumnLeft ... Display the pages in two columns, with odd- numbered pages on the left
1344+ TwoColumnRight ... Display the pages in two columns, with odd- numbered pages on the right
1345+ TwoPageLeft ... Display the pages two at a time, with odd-numbered pages on the left
1346+ TwoPageRight ... Display the pages two at a time, with odd-numbered pages on the right
1347+
1348+ Eg. set page layout:
1349+ pdfcpu pagelayout set test.pdf TwoPageLeft
1350+
1351+ remove page layout:
1352+ pdfcpu pagelayout remove test.pdf
1353+ `
1354+
1355+ usagePageModeList = "pdfcpu pagemode list inFile"
1356+ usagePageModeSet = "pdfcpu pagemode set inFile value"
1357+ usagePageModeReset = "pdfcpu pagemode reset inFile" + generalFlags
1358+
1359+ usagePageMode = "usage: " + usagePageModeList +
1360+ "\n " + usagePageModeSet +
1361+ "\n " + usagePageModeReset
1362+
1363+ usageLongPageMode = `Manage how the document shall be displayed when opened:
1364+
1365+ inFile ... input PDF file
1366+ value ... one of:
1367+
1368+ UseNone ... Neither document outline nor thumbnail images visible (default)
1369+ UseOutlines ... Document outline visible
1370+ UseThumbs ... Thumbnail images visible
1371+ FullScreen ... Full-screen mode, with no menu bar, window controls, or any other window visible
1372+ UseOC ... Optional content group panel visible (since PDF 1.5)
1373+ UseAttachments ... Attachments panel visible (since PDF 1.6)
1374+
1375+ Eg. set page mode:
1376+ pdfcpu pagemode set test.pdf UseOutlines
1377+
1378+ remove page mode:
1379+ pdfcpu pagemode remove test.pdf
1380+ `
1381+
1382+ usageViewPrefList = "pdfcpu viewpreferences list inFile"
1383+ usageViewPrefSet = "pdfcpu viewpreferences set inFile inFileJSON | nameValuePair..."
1384+ usageViewPrefReset = "pdfcpu viewpreferences reset inFile" + generalFlags
1385+
1386+ usageViewPrefMode = "usage: " + usageViewPrefList +
1387+ "\n " + usageViewPrefSet +
1388+ "\n " + usageViewPrefReset
1389+
1390+ usageLongViewPrefMode = `Manage the way the document shall be displayed on the screen and shall be printed:
1391+
1392+ inFile ... input PDF file
1393+ inFileJSON ... input JSON file containing viewing preferences
1394+ nameValuePair ... 'name = value'
1395+
1396+ The preferences are:
1397+
1398+ HideToolbar ... Hide tool bars when the document is active (default=false).
1399+ HideMenubar ... Hide the menu bar when the document is active (default=false).
1400+ HideWindowUI ... Hide user interface elements in the document’s window (default=false).
1401+ FitWindow ... Resize the document’s window to fit the size of the first displayed page (default=false).
1402+ CenterWindow ... Position the document’s window in the centre of the screen (default=false).
1403+ DisplayDocTitle ... true: The window’s title bar should display the document title taken from the dc:title element of the XMP metadata stream.
1404+ false: The title bar should display the name of the PDF file containing the document (default=false).
1405+
1406+ NonFullScreenPageMode ... How to display the document on exiting full-screen mode:
1407+ UseNone = Neither document outline nor thumbnail images visible (=default)
1408+ UseOutlines = Documentoutlinevisible
1409+ UseThumbs = Thumbnail images visible
1410+ UseOC = Optional content group panel visible
1411+
1412+ Direction ... The predominant logical content order for text
1413+ L2R = Left to right (=default)
1414+ R2L = Right to left (including vertical writing systems, such as Chinese, Japanese, and Korean)
1415+
1416+ Duplex ... The paper handling option that shall be used when printing the file from the print dialogue (since PDF 1.7):
1417+ Simplex = Print single-sided
1418+ DuplexFlipShortEdge = Duplex and flip on the short edge of the sheet
1419+ DuplexFlipLongEdge = Duplex and flip on the long edge of the sheet
1420+
1421+ PickTrayByPDFSize ... Whether the PDF page size shall be used to select the input paper tray.
1422+ PrintPageRange ... The page numbers used to initialize the print dialogue box when the file is printed (since PDF 1.7).
1423+ The array shall contain an even number of integers to be interpreted in pairs, with each pair specifying
1424+ the first and last pages in a sub-range of pages to be printed. The first page of the PDF file shall be denoted by 1.
1425+ NumCopies ... The number of copies that shall be printed when the print dialog is opened for this file (since PDF 1.7).
1426+ Enforce ... Array of names of Viewer preference settings that shall be enforced by PDF processors and
1427+ that shall not be overridden by subsequent selections in the application user interface (since PDF 2.0).
1428+ Possible values: PrintScaling
1429+
1430+ Eg. list viewer preferences:
1431+ pdfcpu viewpref list test.pdf
1432+
1433+ remove viewer preferences:
1434+ pdfcpu viewpref remove test.pdf
1435+
1436+ set printer preferences:
1437+ pdfcpu viewpref add test.pdf 'duplex = duplexFlipShortEdge' 'printPageRange = 1 4 10 20' 'numcopies = 3'
1438+
1439+ set viewer preferences:
1440+ pdfcpu viewpref add test.pdf 'fitwindow = true', 'hidetoolbar = t', 'centerwindow = yes', 'hidemenubar = y'
1441+
1442+ set viewer preferences via JSON:
1443+ pdfcpu viewpref add test.pdf viewpref.json
1444+
1445+ and eg. viewpref.json (each preferences is optional!):
1446+
1447+ {
1448+ "viewingPreferences": {
1449+ "HideToolBar": true,
1450+ "HideMenuBar": false,
1451+ "HideWindowUI": false,
1452+ "FitWindow": true,
1453+ "CenterWindow": true,
1454+ "DisplayDocTitle": true,
1455+ "NonFullScreenPageMode": "UseThumbs",
1456+ "Direction": "R2L",
1457+ "Duplex": "Simplex",
1458+ "PickTrayByPDFSize": false,
1459+ "PrintPageRange": [
1460+ 1, 4,
1461+ 10, 20
1462+ ],
1463+ "NumCopies": 3,
1464+ "Enforce": [
1465+ "PrintScaling"
1466+ ]
1467+ }
1468+ }
1469+
1470+ `
13251471)
0 commit comments