문서·데이터 라이브러리Document & data libraries

pdf-annotation-rotation

PDF나 캔버스 주석(상자, 선, 잉크, 원본 마스크)을 표시 좌표에서 90도 회전합니다. 입력은 바꾸지 않습니다.

GitHub에서 보기View on GitHub

어떤 문제를 푸나The problem

페이지를 회전하면 모든 주석이 따라 움직여야 합니다. 회전마다 너비와 높이를 바꾸고, 상자는 왼쪽 아래 모서리를 회전하고, rot를 올리는 계산은 조금만 틀려도 어긋납니다.

이 라이브러리는 그 기하만 순수 함수로 구현해서 복사본을 돌려줍니다.

이런 분께 맞습니다Who it is for

PDF 편집기나 주석 도구를 만드는 개발자.

무엇을 하나What it does

  • rotateCW와 rotateCCW가 text, image, highlight, cover, rect, ellipse, line, ink를 지원합니다.
  • sourceMask도 같이 회전하며 중첩 깊이 8을 넘으면 거부합니다.
  • 지원하지 않는 유형, 유한하지 않은 좌표, 음수 크기는 오류입니다.

직접 돌려 본 출력Real output

저장소의 examples 폴더를 실행한 결과입니다.

$ node examples/quickstart.mjs
before  {"type":"text","x":10,"y":20,"w":50,"h":12,"rot":0}
after   {"type":"text","x":68,"y":10,"w":12,"h":50,"rot":90}
input untouched: true
round trip equals original: true
ink     [[100,0],[0,200]]
reject  unsupported annotation type

알아둘 한계Limits

  • PDF 직렬화나 안전한 가리기(redaction)는 하지 않습니다. 페이지 경계 검사도 없습니다.

받아서 쓰기Get it

# 저장소를 받습니다
git clone https://github.com/Kein-chronicle/pdf-annotation-rotation.git

# Claude Code 스킬로 쓰려면 이 폴더 이름으로 받습니다
git clone https://github.com/Kein-chronicle/pdf-annotation-rotation.git ~/.claude/skills/annotation-rotation

정보Info

분류Category
문서·데이터 라이브러리Document & data libraries
형태Type
라이브러리Library
라이선스License
MIT
필요한 것Requires
Node.js 22 이상
저장소Repository
pdf-annotation-rotation
토픽Topics
pdf annotations geometry javascript esm canvas rotation zero-dependencies

2026-10-18 기준: 저장소의 테스트를 로컬에서 실행해 통과했고, 예제 출력은 저장소의 examples 폴더를 실제로 실행한 결과입니다.

공유하기Share

문자Message 네이버 블로그Naver Blog X Facebook