m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/pdf.md
blob: 7cc5cf0764c94921f04cd94cf4bb90508aa4221c (plain)
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
# PDF operations

## Merge

    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=out.pdf in1.pdf in2.pdf

GhostScript uses some algorithm to autodetect page orientation, and may
undersireably flip some pages. To disable this, add:

    "-dAutoRotatePages=/None"

## Compress

    gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/default -dNOPAUSE -dQUIET -dBATCH -dDetectDuplicateImages -dCompressFonts=true -r150 -sOutputFile=output.pdf input.pdf

## Extract pages

    pdfjam --outfile out.pdf in.pdf 1,3,4-7

`--landscape` to set orientation of output pages.

`--angle <angle>` to rotate (counter clockwise).

## Images to pdf

    convert in1.jpg in2.jpg out.pdf

## DjVu to pdf

    ddjvu -format=pdf file.fjvu file.pdf

* `-quality=85`: can be used to produce smaller output
  * `-quality=uncompressed`: disable compression
* `-page=23-48,59`: select pages to convert
* `-verbose`
* `-eachpage`: generates a separate file per page