diff --git a/content/working-with-a-file/operations.md b/content/working-with-a-file/operations.md index 2d395f8..b210676 100644 --- a/content/working-with-a-file/operations.md +++ b/content/working-with-a-file/operations.md @@ -22,7 +22,7 @@ pages and `1,1` gives two copies. ## The verbs -Merge, select, delete, reverse, move, rotate, crop, resize, split; n-up, +Merge, select, delete, reverse, move, rotate, turn by any angle, crop, resize, split; n-up, booklet, overlay and underlay, blank pages; watermarks, page numbers, Bates stamps and free stamps; placing a picture — a signature, a logo, a seal; sanitize, flatten, strip; compress, encrypt, decrypt and permissions; @@ -32,6 +32,27 @@ straightening a scan; and reading a page back as text or as pictures. a signature, put where you say. It is not cryptography and does not claim to be — a drawn squiggle proves nothing about who drew it. +## Turning a page by any angle + +`rotate` writes a number on the page — `/Rotate`, a multiple of ninety — and +`turn` rewrites the page onto a sheet of its own, for every angle in between. + +```sh +pdfops turn -by 30 tilted.pdf turned.pdf +pdfops turn -pages 2,5-7 -by -1.5 scan.pdf nudged.pdf +``` + +⛔ **The paper grows and nothing is cut off.** The sheet is the turned page's +bounding box — `w·|cos θ| + h·|sin θ|` across, `w·|sin θ| + h·|cos θ|` down — +and the page is centred on it. That is the difference from straightening a +scan, below, which keeps the paper it was given. + +An angle that is a multiple of ninety goes through `/Rotate` and nothing else +happens: no transformation, no new content stream, and text that was selectable +stays selectable. + +**Positive is clockwise**, as ISO 32000-1 Table 30 and `Rotate` already mean it. + ## Straightening a scan `deskew` measures how far each page is tilted and turns the crooked ones back. diff --git a/content/working-with-a-file/workbench.md b/content/working-with-a-file/workbench.md index baab643..ffb36e9 100644 --- a/content/working-with-a-file/workbench.md +++ b/content/working-with-a-file/workbench.md @@ -145,6 +145,29 @@ Beside the page rather than over it, because nearly every verb changes the document and the document is drawn from what would be saved — typing a crop box and watching the page come back cropped is the whole point. +### Turning by an angle that is not a quarter + +**Turn them by an angle**, beside *Turn them*, takes the angles the cycle +button cannot say: any number of degrees, clockwise, added to whatever the page +already carries. + +⛔ **The paper grows and nothing is cut off.** A page turned thirty degrees +comes back on a bigger sheet, because a sheet that stayed the same size would +have two corners of the page over its edge. The status line says so — +*"turned 1 by 30 degrees — the paper grew to hold the corners"* — since that is +the part nobody expects. It is the one difference from **straightening a +crooked scan**, which keeps the paper it was given: a fraction of a degree on a +page whose text sits well inside its margins costs nothing. + +A quarter, a half or three quarters still go through the page's own `/Rotate` +and change nothing else about the file, so text that was selectable stays +selectable. + +⛔ The two controls **share a row**, which is not a matter of taste: given a row +of its own the angle pushed the Pages panel forty-four pixels past the bottom +of its box, and a last control that can only be scrolled to is a control people +do not find. The workbench has a test that measures exactly that. + Every verb is one [`toolkit.Action`](https://pkg.go.dev/github.com/go-widgets/toolkit#Action), so a verb that cannot run greys on every surface showing it: the arrows at the