# Third-Party Licenses ## dart-pdf **Repository:** https://github.com/DavBfr/dart_pdf **License:** Apache License 2.0 **Copyright:** Copyright 2018-2025 DavBfr and the dart-pdf contributors ### Architecture Attribution The Nigig PDF crate architecture — four-layer crate separation (`pdf-cos` → `pdf-document` → `pdf-graphics` → `pdf-makepad`), the PdfDevice trait pattern, the content-stream interpreter pipeline, and the golden-test methodology at the engine-neutral boundary — was derived from the dart-pdf package architecture (commit `17df3d01`, release 3.1.1). ### Key Architectural Patterns Inherited from dart-pdf 1. **Crate/Package Boundaries** — dart-pdf's four packages (`pdf`, `pdf_document`, `pdf_graphics`, `printing`) directly informed the four-crate Rust structure. 2. **PdfDevice Interface** — The device/callback pattern for content stream interpretation (dart-pdf's `PdfDevice` class) became the `PdfDevice` trait in `pdf-graphics`. 3. **Font Engine Design** — dart-pdf's `Font` class and CID font handling architecture informed the `GlyphWidths`, `CMap`, and `SFNT` parsing modules. 4. **Content Stream Parser** — The single-pass operator parsing approach was adapted from dart-pdf's `ContentStream` parser. 5. **Test Structure** — dart-pdf's three testing layers (unit tests, corpus tests, golden tests) were replicated. ### Modified from Original The following adaptations were made from dart-pdf's implementation: - **Language**: Ported from Dart to Rust, using Rust idioms (ownership, traits, pattern matching) - **Compression**: Uses `miniz_oxide` crate instead of Dart's `zlib` - **Incremental Updates**: Extended from dart-pdf's `update` package - **Encryption**: Implemented with `rc4`, `aes`, and `md-5` crates; adapted from dart-pdf's crypto implementations - **Rendering**: PDF → makepad DrawVector/DrawText instead of Flutter canvas ### dart-pdf License Text ``` Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. "Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. "Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. "You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. "Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. "Object" form shall mean any form resulting from modification of their Source form or additions and modifications of that Source form or Derivative Works thereof, although commercial products may be subject to the provisions of Section 10.1(a) of this License. "Work" (or "Project") shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). "Derivative Works" or "Modifications" shall mean any work of authorship, whether in Source or Object form, that is based upon the Work (including, but not limited to, modifications to source code or other modifications of the Work) submitted by the copyright owner for inclusion in the Work by the copyright owner. 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work is the subject of patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and (b) You must cause any modified files to carry prominent notices stating that You changed the files; and (c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work excluding those notices that do not pertain to any part of the Derivative Works; and (d) If the Work includes a "NOTICE" text file as part of its authorship; or within a display generated by the Work, if and wherever third-party notices normally appear. Unless intentionally given to You by the Licensor, you may not use, reproduce, or modify the Licensed Material except in compliance with this License. You may have additional consumer warranties or conditions, so long as such additional warranties or conditions do not impose any additional obligations or liabilities, and in no event shall you attempt to limit or exclude any such warranties or conditions. 5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of the License, without any additional terms or conditions. Notwithstanding the above, the terms of this License do not exempt You from the legal obligation to secure any other licenses or rights that are necessary to use, copy, modify, and distribute the Work. 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the Work. 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with your exercise of permissions or license under the License. 8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts for calculated damages), or in any manner reasonably related to any single Event of loss, damage, or injury arising out of the Work, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. 9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your acceptance of such warranty or additional liability. END OF TERMS AND CONDITIONS APPENDIX: How to apply the Apache License to your work. For easy redistribution by licensees of an Apache-licensed product, the accompanying NOTICE file may be replaced with this notice: Copyright 2018-2025 DavBfr Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ``` ## makepad **Repository:** https://github.com/andodeki/makepad **License:** MIT OR Apache-2.0 (dual-licensed) **Copyright:** Copyright 2024 Makepad authors The `pdf-makepad` crate depends on the Makepad framework (`makepad-widgets`) for rendering PDF content to GPU draw lists. Makepad is dual-licensed under MIT and Apache-2.0. ``` MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` ## miniz_oxide **Repository:** https://github.com/bytecode-crypt/miniz_oxide **License:** MIT OR Zlib **Copyright:** Copyright (c) 2018 The Chromium Authors and miniz_oxide contributors Used by `nigig-pdf-cos` for FlateDecode decompression and zlib compression of PDF objects. ``` MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ``` ## Crypto Dependencies (encryption) The following crates are used by `nigig-pdf-cos` for PDF encryption: - **rc4** (`rc4` crate) — MIT OR BSD-3-Clause - **aes** (`aes` crate) — MIT OR Apache-2.0 - **md-5** (`md-5` crate) — MIT OR Apache-2.0 - **sha2** (`sha2` crate) — MIT OR Apache-2.0 - **block-modes** (`block-modes` crate) — MIT OR Apache-2.0 - **cbc** (`cbc` crate) — MIT OR Apache-2.0 - **cipher** (`cipher` crate) — MIT OR Apache-2.0 - **crypto-common** (`crypto-common` crate) — MIT OR Apache-2.0 - **block-padding** (`block-padding` crate) — MIT OR Apache-2.0 - **block-buffer** (`block-buffer` crate) — MIT OR Apache-2.0 - **inout** (`inout` crate) — MIT OR Apache-2.0 - **digest** (`digest` crate) — MIT OR Apache-2.0