github razvandimescu/gopdf v0.9.1
v0.9.1 — Image.FitRotated watermark sizing helper

latest releases: v0.11.2, v0.11.1, v0.11.0...
4 months ago

What's new

(*Image).FitRotated

w, h := logo.FitRotated(pageW, pageH, 45, 0.85)

Returns the on-page width/height at which to draw an image so that, once rotated by the given angle, its bounding box occupies scale (0..1) of the page in both dimensions — aspect ratio preserved. Pair it with an ImageOverlay whose Width/Height are the returned values and whose Rotation matches.

This extracts the sizing math previously inlined in cmd/watermark so external callers (e.g. the Rinkt runner's WatermarkPDF activity) size watermarks identically without copy-pasting the geometry.

New API

  • (*Image).FitRotated(pageW, pageH, rotation, scale float64) (width, height float64)

Full Changelog: v0.9.0...v0.9.1

Don't miss a new gopdf release

NewReleases is sending notifications on new releases.