Hoping someone can help me, or at least tell me I'm not crazy. I'm creating a stamp that when applied to the target document, will include a list of names that were entered in a dialog box, and then overlay a digital signature field on top of each name. Everything works except that I can't get the size of the stamp to change based on the number of names entered.
I'm able to use this.getPageBox and this.setPageBoxes to output the initial and changed dimensions of the stamp media/crop/art/trim/bleed boxes to the console, but the stamp only ever gets applied with dimensions matching the initial values. The new setPageBoxes values are ignored.
I know I'm overthinking this and should just make the source stamp with enough whitespace to handle what I would guess to be the highest possible number of names someone would want, but I don't know why the above method can't work.
Example PDF attached with a limited JS to demonstrate the problem I'm having. No matter what, the stamp gets applied at 2.68" x 1.21". Console log however shows that the various stamp boxes are taking the new dimensions set by the setPageBoxes method.
For reference, here is my console output when placing the attached stamp:
=== Stamp placement begin ===
Desired stamp size: 324 × 180 pt (~4.50in × 2.50in)
Using rBox = [0, 180, 324, 0] // [left, TOP, right, BOTTOM]
— STAMP (before) page 1 boxes —
MediaBox: [0, 87.1199951171875, 192.95999145507812, 0]
CropBox: [0, 87.1199951171875, 192.95999145507812, 0]
ArtBox: [0, 87.1199951171875, 192.95999145507812, 0]
TrimBox: [0, 87.1199951171875, 192.95999145507812, 0]
BleedBox: [0, 87.1199951171875, 192.95999145507812, 0]
BBoxBox: [0, 87.1199951171875, 192.95999145507812, 0]
Set MediaBox on STAMP page 1 to [0, 180, 324, 0]
Set CropBox on STAMP page 1 to [0, 180, 324, 0]
Set ArtBox on STAMP page 1 to [0, 180, 324, 0]
Set TrimBox on STAMP page 1 to [0, 180, 324, 0]
Set BleedBox on STAMP page 1 to [0, 180, 324, 0]
— STAMP (after) page 1 boxes —
MediaBox: [0, 180, 324, 0]
CropBox: [0, 180, 324, 0]
ArtBox: [0, 180, 324, 0]
TrimBox: [0, 180, 324, 0]
BleedBox: [0, 180, 324, 0]
BBoxBox: [0, 180, 324, 0]
--- Target document info ---
Target file: SecureSigStamp.pdf
Active page: 1 / 1
— TARGET (current page) page 1 boxes —
MediaBox: [0, 792, 612, 0]
CropBox: [0, 792, 612, 0]
ArtBox: [0, 792, 612, 0]
TrimBox: [0, 792, 612, 0]
BleedBox: [0, 792, 612, 0]
BBoxBox: [0, 792, 612, 0]
=== Stamp placement end ===
Thanks in advance!