- 注釈の default user space における原点(0,0)と CropBox における原点(0,0)の対応が良く分からない。
- 次の変更を加えた際、注釈の default user space の座標を見るため、注釈の長方形を描画する。
- CropBox と MediaBox を変更
- ページを回転
if (false) {
void function () {
const doc = this;
const pageNum = doc.pageNum;
const [x1, y1] = [0, 0];
const [x2, y2] = [210 + x1, 297 + y1];
const rot = 0;
const boxCrop = [
x1, y2, x2, y1
].map( x => (72 / 25.4) * x );
const boxMedia = [
0, boxCrop[1] - boxCrop[3], boxCrop[2] - boxCrop[0], 0
];
doc.setPageBoxes({
cBox: "Crop", nStart: pageNum, nEnd: pageNum, rBox: boxCrop
});
doc.setPageBoxes({
cBox: "Media", nStart: pageNum, nEnd: pageNum, rBox: boxMedia
});
["Art", "Trim", "Bleed"].forEach( box => {
doc.setPageBoxes({cBox: box, nStart: pageNum, nEnd: pageNum});
});
doc.setPageRotations({
nStart: pageNum, nEnd: pageNum, nRotate: rot
});
}();
} else {
void 0;
}
(() => {
const doc = this;
const pageNum = doc.pageNum;
const arrCrop = doc.getPageBox({cBox: "Crop", nPage: pageNum});
const arrBBox = doc.getPageBox({cBox: "BBox", nPage: pageNum});
const annotSquareAxisX = doc.addAnnot({
page: pageNum, type: "Square",
rect: [0, 0, 200, 0].map( x => (72 / 25.4) * x ),
style: "S", borderEffectStyle: "",
strokeColor: ["RGB", 192 / 255, 0 / 255, 0 / 255], opacity: 1.0,
width: 10, fillColor: ["T"],
author: "axis X", subject: "X座標"
});
const annotSquareAxisY = doc.addAnnot({
page: pageNum, type: "Square",
rect: [0, 0, 0, 200].map( x => (72 / 25.4) * x ),
style: "S", borderEffectStyle: "",
strokeColor: ["RGB", 0 / 255, 192 / 255, 0 / 255], opacity: 1.0,
width: 10, fillColor: ["T"],
author: "axis Y", subject: "Y座標"
});
const annotSquareCrop = doc.addAnnot({
page: pageNum, type: "Square",
rect: [arrCrop[0], arrCrop[3], arrCrop[2], arrCrop[1]],
style: "S", borderEffectStyle: "",
strokeColor: ["RGB", 255 / 255, 128 / 255, 0 / 255], opacity: 1.0,
width: 5, fillColor: ["T"],
author: "Crop", subject: "Crop"
});
const annotSquareBBox = doc.addAnnot({
page: pageNum, type: "Square",
rect: [arrBBox[0], arrBBox[3], arrBBox[2], arrBBox[1]],
style: "S", borderEffectStyle: "",
strokeColor: ["RGB", 0 / 255, 128 / 255, 255 / 255], opacity: 1.0,
width: 5, fillColor: ["T"],
author: "BBox", subject: "BBox"
});
})();