std/pdfmodulejsscheller/scrilib
Functions
annotate
Annotate a PDF - add images, signatures and text.
compress
Reduce the size of a PDF.
decrypt
Remove PDF encryption. Note: encrypting a PDF and password-protecting a PDF are two different things. Learn more [here](./#pdf-encryption-vs-password-protecting).
encrypt
Encrypt a PDF. Note: encrypting a PDF and password-protecting a PDF are two different things. Learn more [here](./#pdf-encryption-vs-password-protecting).
extract_images
Extract images from a PDF.
from_images
Convert images to PDFs.
merge
Combine multiple PDFs into one.
render
Convert PDF to image - only JPEG supported at this time.
repage
Remove and reorder pages in a PDF.
rotate
Rotate pages in a PDF.
split
Split a single PDF into multiple PDFs.

Page-selection syntax

  • Specify a single page using its number - eg. 3 for the third page.
  • Specify a page range using range notation - eg. 1..3 for the first, second and third page.
  • Combine multiple single-pages/ranges using a comma - eg. 1,3..4 for the first, third and fourth page.
  • Negative numbers count from the end - eg. -1 refers to the last page.

Examples:

1,6,4pages 1, 6, and 4
3..7pages 3 through 7 inclusive
7..3pages 7, 6, 5, 4, and 3
1..-1all pages
1,3,5..9,15..12pages 1, 3, 5, 6, 7, 8, 9, 15, 14, 13, and 12
-1the last page
-3..-1the third to last, second to last and last page
-1..-3the last, second to last and third to last page
5,7..9,12pages 5, 7, 8, 9, and 12

PDF encryption VS password-protection

The terms “PDF encryption” and “password-protecting a PDF” are often used interchangeably, but they’re not precisely the same thing. Both are mechanisms to protect the content of a PDF file, but they work in slightly different ways.

  • PDF Encryption: This is a method to secure the data inside a PDF file using various encryption algorithms, such as RC4, AES (varying key lengths: 128, 256 bits), etc. The purpose of PDF encryption is to protect the content of the PDF from being accessed or modified by unauthorized users. When a PDF file is encrypted, its contents are converted into unreadable format which can only be decrypted using the appropriate key.

There are two kinds of passwords in the context of PDF encryption:

  • The owner password: When a PDF is encrypted with an owner password, restrictions can be placed on the document such as preventing printing, copying, editing, etc. The owner password is required to change these permission settings. - The user (or document open) password: If a PDF is encrypted with a user password, that password is required to open the document.

  • Password-protecting a PDF: This generally refers to the practice of applying a password to a PDF so that users must enter the password before they can open and view the PDF. This is essentially using the user password aspect of the PDF encryption. It doesn’t necessarily specify the encryption level or permissions applied to the document, which are more in the realm of PDF encryption.

So while there is significant overlap between these two concepts, it’s not 100% accurate to use them interchangeably. The key takeaway here is that password protection is a feature of PDF encryption, but PDF encryption can also include additional security measures beyond just password protection.