Skip to content

Instantly share code, notes, and snippets.

@lyhcode
Created June 14, 2012 13:01
Show Gist options
  • Select an option

  • Save lyhcode/2930137 to your computer and use it in GitHub Desktop.

Select an option

Save lyhcode/2930137 to your computer and use it in GitHub Desktop.
PDF processing with iText
//中文字型
BaseFont.createFont('MHei-Medium', 'UniCNS-UCS2-H', BaseFont.NOT_EMBEDDED)
//檔案加密
def stamper = new PdfStamper(reader, response.outputStream)
stamper.setEncryption(null, OWNER, ~(PdfWriter.ALLOW_PRINTING|PdfWriter.ALLOW_COPY|PdfWriter.ALLOW_MODIFY_CONTENTS|PdfWriter.ALLOW_MODIFY_ANNOTATIONS), PdfWriter.ENCRYPTION_AES_128 | PdfWriter.DO_NOT_ENCRYPT_METADATA)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment