You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a problem with the new multi stamping feature introduced in v0.6.0: it can skip several last pages of the stamp PDF file.
For example: pdfcpu stamp add -mode pdf -- "stamp.pdf:1:2" "" in.pdf out.pdf
In case if in.pdf is 5 pages and stamp.pdf is 2 pages, then in the output pages 2-5 will be stamped with page 1 of stamp.pdf. While the expected out.pdf should have page 2 stamped with page 1 of stamp.pdf and pages 3-5 stamped with page 2 of stamp.pdf.
In our test case 1 + 2 - 1 = 2, thus only pages 1 and 2 skip the test on the next line (pageNr > maxStampPageNr), that is why pages 3-4 get the same stamp as page 2.
It seems to me that the correct one would be maxStampPageNr := wm.PdfMultiStartPageNrDest + len(wm.PdfRes) - 1.
The text was updated successfully, but these errors were encountered:
There is a problem with the new multi stamping feature introduced in v0.6.0: it can skip several last pages of the stamp PDF file.
For example:
pdfcpu stamp add -mode pdf -- "stamp.pdf:1:2" "" in.pdf out.pdf
In case if in.pdf is 5 pages and stamp.pdf is 2 pages, then in the output pages 2-5 will be stamped with page 1 of stamp.pdf. While the expected out.pdf should have page 2 stamped with page 1 of stamp.pdf and pages 3-5 stamped with page 2 of stamp.pdf.
Here goes an example:
Looks like the problem is here:
maxStampPageNr := wm.PdfMultiStartPageNrSrc + len(wm.PdfRes) - 1
(https://github.com/pdfcpu/pdfcpu/blob/master/pkg/pdfcpu/stamp.go#L1022)In our test case
1 + 2 - 1 = 2
, thus only pages 1 and 2 skip the test on the next line (pageNr > maxStampPageNr
), that is why pages 3-4 get the same stamp as page 2.It seems to me that the correct one would be
maxStampPageNr := wm.PdfMultiStartPageNrDest + len(wm.PdfRes) - 1
.The text was updated successfully, but these errors were encountered: