iTextSharp - Crop PDF File (C#)

后端 未结 1 1724
一个人的身影
一个人的身影 2021-01-06 06:03

I want to crop PDF File using iTextSharp and rectangle (0,1000,600,155). Everything is fine and when you open created *.pdf file you can see only that cropped content, BUT!

1条回答
  •  迷失自我
    2021-01-06 06:47

    What you're doing is setting the CropBox of the page, which does absolutely nothing to the content of the document. This is by design and was always like that since Acrobat 1.0.

    What you want to do is called redaction (or in your case, exclusive redaction since you want to remove everything outside the bounds of a rectangle). It is decidedly non-trivial to do correctly, mostly because of issues with content that partially overlaps the bounds to which to want to redact (images, text, and paths).

    0 讨论(0)
提交回复
热议问题