How opacity, rotation, and centering work under the hood
pdf-lib's drawText accepts an opacity that sets the graphics state's fill alpha for that operation, so the text blends with whatever is beneath it instead of fully covering it. Rotation is applied around the text's baseline-start point using pdf-lib's degrees() helper, which pdf-lib translates into a PDF content-stream rotation matrix. To keep the rotated text visually centered on the page regardless of angle, this tool measures the string's width (font.widthOfTextAtSize) and height (font.heightAtSize), treats half of each as the offset from the baseline-start point to the text's visual center, and rotates that offset vector by the chosen angle to solve for the baseline-start coordinates that place the rotated center exactly at the page's midpoint — the same trigonometry used to rotate any point around a pivot.