---
Product: Aspose.PDF
Platform: java
Page Type: kb
Canonical URL: https://kb.aspose.org/pdf/java/faq
---

# FAQ — Aspose.PDF FOSS for Java

Frequently asked questions about Aspose.PDF FOSS for Java.

## Frequently Asked Questions

### What Java version is required?

Aspose.PDF FOSS for Java requires Java 11 or later. JDK LTS releases (11, 17, 21)
are recommended for production use.

### Is the library free to use?

Yes. Aspose.PDF FOSS for Java is MIT-licensed. No commercial agreement, API key,
or activation is required.

### How do I add the library to a Maven project?

Add the following to your `pom.xml`:

```xml
<dependency>
  <groupId>org.aspose</groupId>
  <artifactId>aspose-pdf-foss</artifactId>
  <version>26.11.0</version>
</dependency>
```

### How do I create a new PDF document?

Use the `Document` class with no arguments:

```java
try (Document doc = new Document()) {
    doc.getPages().add();
    doc.save("output.pdf");
}
```

### How do I get the page count of an existing document?

Open the document and call `size()` on the pages collection:

```java
try (Document doc = new Document("input.pdf")) {
    int count = doc.getPages().size();
}
```

### How do I concatenate two PDF files?

Use `PdfFileEditor.concatenate()`:

```java
PdfFileEditor editor = new PdfFileEditor();
editor.concatenate("first.pdf", "second.pdf", "merged.pdf");
```

### How do I encrypt a PDF?

Use `PdfFileSecurity` from the facades package with `DocumentPrivilege` and `KeySize`:

```java
try (PdfFileSecurity security = new PdfFileSecurity("input.pdf", "secured.pdf")) {
    DocumentPrivilege priv = DocumentPrivilege.getForbidAll();
    priv.setAllowPrint(true);
    security.encryptFile("user", "owner", priv, KeySize.x256);
}
```

### How do I apply AES encryption to data?

Use `AESCipher` static methods for raw byte-level AES encryption and decryption:

```java
byte[] ciphertext = AESCipher.encrypt(key, plaintext);
byte[] decrypted  = AESCipher.decrypt(key, ciphertext);
```

### Where is the source code?

The source code and issue tracker are available at
`https://github.com/aspose-pdf-foss/Aspose.PDF-FOSS-for-Java`.

## See Also

- [Aspose.PDF for Java — Enterprise Knowledge Base](https://kb.aspose.com/pdf/java/)