Commit Graph

84 Commits

Author SHA1 Message Date
Michael R Sweet
b3aaf2e70f Initial GIF support (Issue #145) 2026-01-18 10:31:50 -05:00
Michael R Sweet
65098b5509 Fix implementation of LZWDecode filter to account for the EarlyChange parameter
(somewhat buried, very frustrating...)

Add some debugging and update the test suite to find page metadata in any parent
page object.
2026-01-16 15:57:43 -05:00
Michael R Sweet
09520d250f Add support for LZWDecode filter, needs more testing (Issue #11) 2026-01-16 09:53:51 -05:00
Michael R Sweet
bdcd963352 Implement ASCII85Decode filter (Issue #11) 2026-01-14 09:31:41 -05:00
Michael R Sweet
0feace3eb5 Fix AES-256 key initialization. 2026-01-10 14:44:47 -05:00
Michael R Sweet
089288946e Increase PDFIO_MAX_STRING to 128k (Issue #146) 2026-01-06 11:21:58 -05:00
Michael R Sweet
c2b25a1fa0 Support Encrypt dictionaries as well as indirect references (Issue #139) 2025-12-21 19:04:36 -05:00
Michael R Sweet
26a92febc6 Cleanup PR for PDF/A support and add documentation (Issue #122) 2025-10-05 15:19:15 -04:00
vididvidid
a08614911a added the comment at the end of line tyepdef enum _pdfio_pdfa_e 2025-10-01 05:06:49 +00:00
vididvidid
f7db310942 added the enum for the conformance levels in the pdfio-private.h under _pdfio_file_s and updated the create_common() function which is used by pdfiofilecreate to recognize the new pdf/a-.. strings 2025-09-30 04:38:35 +00:00
Michael R Sweet
2582052377 More tagged PDF changes (Issue #123):
- Add MarkInfo dictionary to document catalog when generating marked content.
- Add basic structured tags to md2pdf example.
2025-09-18 12:08:55 -04:00
Michael R Sweet
57a01a7317 Fix object map to use unique file hash instead of pointer values (Issue #125) 2025-04-24 14:00:24 -04:00
Michael R Sweet
cad8f450ab Multiple fixes to allow PDFio to read more edge-case PDFs.
- Update _pdfioFileGets to allow for really long lines where it
  doesn't matter if we lose the end of the line.
- Update "startxref" detection at the end of the file.
- Refactor repair logic so that you just get a single WARNING about
  the repair (debug messages available for testing)
- Allow whitespace after the "obj" in the object header.
- Make sure to close xref stream on error.
- Update predictor code to support Colors <= 32 (some implementations
  set Colors to the number of bytes per record in the xref stream,
  which prevents the predictor from doing anything...)
- Allow CR CR in xref table.
- Clear old trailer/root/pages/etc. objects when repairing, update
  existing objects that were already found in load_xref.
- Don't set current object in pdfioObjectCreate/OpenStream if the
  stream can't be created/opened.
2025-04-24 11:09:54 -04:00
Michael R Sweet
4ca93bd34f Add support for EncryptMetadata key in encryption dictionary. 2025-04-23 10:07:44 -04:00
Michael R Sweet
078985fc20 Try to eliminate more Windows build warnings. 2025-04-18 17:58:06 -04:00
Michael R Sweet
13fedfc424 Try a macro trick to get rid of some Windows build warnings. 2025-04-18 17:29:02 -04:00
Michael R Sweet
1393cd6c04 Hopefully fix Windows build issues. 2025-04-18 17:07:53 -04:00
Michael R Sweet
acd68df592 Start work on OutputIntent and better color support in PDFio:
- Add CGATS001-compatible "micro" ICC profile as a standard CMYK color space
  (this is the default used by several Adobe applications)
- Add `PDFIO_CS_CGATS001` color space enum.
- Extend `pdfioArrayCreateColorFromStandard` to support CMYK.
- Extend `pdfioFileCreateImageObjFromFile` to support CMYK JPEG files.
- Update `pdfioFileCreatePage` to add default grayscale, RGB, and CMYK color
  space resources as needed.
2025-04-13 13:31:19 -04:00
Michael R Sweet
3ae95f1545 Fix decryption of UTF-16 strings (Issue #42) 2025-04-13 09:04:00 -04:00
Michael R Sweet
0bd9edc845 Move token buffers off the stack (Issue #117) 2025-04-04 21:20:23 -04:00
Michael R Sweet
fe755eac3d Add PDFIO_MAX_STRING constant to control maximum allowed PDF strings (Issue #117) 2025-04-04 19:27:03 -04:00
Michael R Sweet
cfe91b4ea2 Fix output of special characters in name values (Issue #106)
Fix output of special characters in string values (Issue #107)
Fi output of large integers in dictionaries (Issue #108)

Bump version to 1.5.1.
2025-03-24 18:33:24 -04:00
Michael R Sweet
5be5552b2b Turn write_obj_header into private API. 2025-02-20 17:37:31 -05:00
Michael R Sweet
492a4f51b2 Allocate stream compression buffer. 2025-02-16 13:20:51 -05:00
Michael R Sweet
afac83530f Add pdfioDictGetKey and pdfioDictGetNumPairs APIs (Issue #63)
Add pdfioArrayRemove and pdfioDictClear APIs (Issue #74)
2024-10-25 17:48:19 -04:00
Michael R Sweet
f040cc41c2 Add #define guard to allow MingW to build PDFio; note that MingW is NOT a supported toolchain for PDFio (Issue #66) 2024-06-24 09:03:46 -04:00
Michael R Sweet
e882622233 Fix locale support (Issue #61) 2024-01-27 18:22:16 -05:00
Michael R Sweet
7330cc35ba Defer object/value decryption to after the object is loaded (Issue #42) 2023-12-14 16:02:26 -05:00
Michael R Sweet
2a85baaf81 Increase the maximum number of object streams in a file (Issue #58) - most files
only contain 1 or 2...

Change the implementation of add/find object to use a custom binary insertion
sort algorithm rather than doing a qsort after every addition.  This results in
a significant improvement in open speed - from 2371 seconds (about 39.5 minutes)
to 3.1 seconds for one large test file (an ESRI standard).
2023-12-13 12:26:25 -05:00
Michael R Sweet
2b92044504 Support per-object file IDs (Issue #42) 2023-12-12 21:48:58 -05:00
Michael R Sweet
c188cb8dad Finish implementation of pdfioContentTextMeasure (Issue #17) 2023-12-04 21:20:51 -05:00
Michael R Sweet
4919783da5 Save work on string measure support (Issue #17) 2023-12-04 18:54:33 -05:00
kleuter
acb6b66bdb added windows.h header for GetTempPathA 2023-10-10 09:12:03 +02:00
Michael R Sweet
a3ea0a99ff Cleanup spacing and comments. 2023-10-06 14:39:42 -04:00
Michael R Sweet
87ca4db73f Clean up private header. 2023-10-02 05:27:40 -04:00
Michael R Sweet
067683cbcd Add some protection against opening multiple streams in the same file at the same time. 2022-07-04 13:03:11 -04:00
Michael R Sweet
a431d7806f Fix a few stack/buffer overflow bugs discovered by Bart, Steffan, and Mark from
the Radboud University NL (thanks!)

- Add depth argument to all value read functions that recurse
- Add depth argument to page tree loading code
- Validate xref stream sizes individually to avoid out-of-bounds access to local
  xref buffer.
2021-11-29 17:46:56 -05:00
Michael R Sweet
790cd440ea Fix up copying objects from unencrypted to AES-encrypted documents (still looks
like there are some issues with strings in dicts)
2021-10-25 21:22:59 -04:00
Michael R Sweet
038046e6d5 Save work on encrypted PDF reading. 2021-10-25 19:36:39 -04:00
Michael R Sweet
234c3a7381 Do some reorganization and start the implementation of decryption. 2021-10-24 10:59:25 -04:00
Michael R Sweet
dd56317635 Need object when reading/writing encrypted PDFs (to decrypt/encrypt strings),
RC4 writing is now working, AES-128 needs work, AES-256 hasn't been done yet.
2021-10-23 18:08:16 -04:00
Michael R Sweet
3af39d5d1f Update crypto callback to return the number of output bytes (to account for AES
expansion).
2021-10-23 14:37:25 -04:00
Michael R Sweet
c24243a2bc Refactor crypto callback to have separate input/output pointers. Add initial writing support. 2021-10-12 09:13:30 -04:00
Michael R Sweet
3de55421b5 New member names to specify type of value. 2021-10-10 22:40:42 -04:00
Michael R Sweet
61a7964d90 Implement pdfioFileSetPermissions. 2021-10-10 22:27:09 -04:00
Michael R Sweet
953de26f6b Add random number generation support. 2021-10-09 23:05:39 -04:00
Michael R Sweet
2245c9d4f5 Move AES code to separate file, prep private API for making keys/contexts/callbacks for encryption. 2021-10-09 10:49:22 -04:00
Michael R Sweet
9c05f802fc Add SHA-256 code from RFC 6234. 2021-10-08 18:55:25 -04:00
Michael R Sweet
7fe093f3bd Save work on AES and RC4. 2021-10-04 21:13:01 -04:00
Michael R Sweet
d6746c08a4 Add pdfioFileCreateOutput API (Issue #21) 2021-09-27 07:41:50 -04:00