https://github.com/itext/pdfdeserializer
A tool that deserializes String representations of PDF Objects into Java/iText objects
https://github.com/itext/pdfdeserializer
Last synced: about 1 year ago
JSON representation
A tool that deserializes String representations of PDF Objects into Java/iText objects
- Host: GitHub
- URL: https://github.com/itext/pdfdeserializer
- Owner: itext
- License: agpl-3.0
- Created: 2023-01-26T12:48:26.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-02-16T09:49:34.000Z (over 3 years ago)
- Last Synced: 2025-04-12T01:03:04.544Z (about 1 year ago)
- Language: Java
- Size: 81.1 KB
- Stars: 7
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# pdfDeserializer
## Summary
pdfDeserializer is a tool that deserializes your PDF syntax into iText objects. It takes a String representation of any of the standard PDF objects:
| Token | Object |
|:-:|:-:|
| << ... >> | Dictionary |
| [ ... ] | Array |
| /Name | Name |
| ( abc ) | String (Literal) |
| < 616263 > | String (Hexadecimal) |
| 1.0 | Number |
| 1 0 R | Indirect Reference |
And it will turn that into a usable com.itextpdf.kernel.pdf.PdfObject instance (of the appropriate subclass of course).
For example:
```
<>
```
Would become:
| Dictionary: | |
| :-- | :-- |
| Name{ Type } | Name{ Example } |
| Name{ Reason } | String{ Because }|
## Building
This project is built using maven. After cloning, run the following command:
```bash
mvn package
```
After a successful build, your target folder should contain a `pdfDeserializer-x.y.z.jar` which you can then use in your projects!
You can also use `mvn install` so that the artifact is automatically installed into your local maven repository!
## Usage
Add the pdfDeserializer dependency to your project and you can start using the tool as a high level tool:
```java
String s = "<>";
Deserializer deserializer = new Deserializer();
PdfObject deserializedDictionary = deserializer.deserialize(ByteUtils.getIsoBytes(s), new DeserializationContext());
```
## Disclaimer
This is an experimental tool, not an iText product. It is provided to the
community under the terms of the AGPL (see [LICENSE](LICENSE.md)) on an as-is
basis.