95 Commits

Author SHA1 Message Date
Michael R Sweet
1237599dea
Clean up some compiler warnings. 2025-02-22 19:48:09 -05:00
Michael R Sweet
e996898b57
Back out object stream changes, as they would require much more significant
reworking of the "write value" private API that I don't want to do right now.
2025-02-21 16:57:01 -05:00
Michael R Sweet
aa6a20c042
Lay the groundwork for object streams. 2025-02-21 15:33:27 -05:00
Michael R Sweet
f09105dd3f
Add support for writing the PCLm subset of PDF (Issue #99) 2025-02-20 18:18:53 -05:00
Michael R Sweet
44827bac1a
Cleanup. 2025-02-16 12:40:39 -05:00
Michael R Sweet
3fad0d6f15
Support xref streams with encrypted output. 2025-02-16 12:35:45 -05:00
Michael R Sweet
aeee24b856
Add xref stream support (Issue #10) 2025-02-15 21:54:16 -05:00
Michael R Sweet
8d72f22efe
Add support for 'repairing' damaged PDF files (Issue #45) 2025-02-15 17:26:23 -05:00
Michael R Sweet
5f98c7838c
Rename pdfioFileGetModDate to pdfioFileGetModificationDate.
Add pdfioFileSetModificationDate API.

Update DLL exports file.

Update docos and changelog.
2025-02-13 18:56:43 -05:00
Thierry LARONDE
d032483ed4
Merge branch 'michaelrsweet:master' into info 2025-02-12 15:54:47 +01:00
Michael R Sweet
9e2f3aba10
Fix reading of compressed object streams (Issue #92) 2025-01-23 15:27:22 -05:00
Thierry LARONDE
8b2b013b36 Extend by adding pdfioGetModDate and extend the pdfioinfo example
When exploring a PDF, it may be convenient to have the typical
informations delivered by some "Document Properties"---and some more
about the MediaBox(es).

So just add the function to get the ModDate and extend the
pdfioinfo example as an example of what the library do have
and pdfioinfo as a debugging tool also.

Signed-off-by: Thierry LARONDE <tlaronde@kergis.com>
2025-01-18 11:25:36 +01:00
Michael R Sweet
3bc041e6d3
Delay loading of the Info object and clean up the pdfioinfo example (Issue #87) 2025-01-17 16:50:30 -05:00
Michael R Sweet
d705d7eb5d
Fix reading PDF files whose trailer is missing a newline (Issue #80) 2024-12-08 19:14:58 -05:00
Sergey Vlasov
4312933409 pdfioFileCreateNameObj implemented 2024-09-25 18:40:36 +03:00
Michael R Sweet
206f75403a
Add debug printfs. 2024-08-26 09:19:34 -04:00
Michael R Sweet
7d22477917
Fix opening of certain encrypted PDF files (Issue #62) 2024-08-21 11:28:39 -04:00
Michael R Sweet
a81907bdb9
Refactor get_info_string to rely on pdfioDictGetString to convert binary strings to regular ones. 2024-06-24 11:49:38 -04:00
Michael R Sweet
23883268e3
Add pdfioFileGetCatalog function (Issue #67)
Refactor the pdfioFileCreateXxx functions to use a common (private) function to
handle creating/initializing the pdfio_file_t object and base file objects.

Update unit tests to display the filename for the pdfioFileClose test.
2024-06-24 08:56:16 -04:00
Michael R Sweet
b117959725
Make sure all output code paths set the locale information (Issue #61) 2024-01-27 19:23:51 -05:00
Michael R Sweet
e882622233
Fix locale support (Issue #61) 2024-01-27 18:22:16 -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
f4aa951165
Fix _pdfioFileSeek with whence==SEEK_CUR
Fix seek offset after trailer.

Look at the last 1k of the file to find the startxref marker.
2023-12-12 12:24:49 -05:00
Michael R Sweet
038fd8686b
Fix trailer dictionary handling (Issue #58)
Fix generation number handling for object 0 (Issue #59)
2023-12-11 19:56:00 -05:00
Michael R Sweet
c992b2ba89
Update the token reading code to protect against obvious format abuses.
Update the xref loading code to protect against looping xref tables.
2023-12-07 17:50:52 -05:00
Michael R Sweet
86d842167a
Bring back mis-named pdfioContentTextNextLine. 2023-12-05 13:33:07 -05:00
Michael R Sweet
16c8b830b8
Add pdfioFileCreateNumber/StringObj functions (Issue #14) 2023-12-05 08:16:41 -05:00
Michael R Sweet
c6f17cc20f
Fix some warnings. 2023-12-03 19:23:36 -05:00
Michael R Sweet
ddd984215a
Save work (debug printfs, etc.) 2023-11-15 08:38:47 -05:00
Michael R Sweet
b0a66eef78
Fix reading of PDF files from Crystal Reports (Issue #45) 2023-10-09 10:04:20 -04:00
Michael R Sweet
b0e4646f9d
Rework CR/LF skip code to be more consistent. 2023-10-06 14:41:55 -04:00
Michael R Sweet
7f6ffcda22
Fix a couple issues with parsing PDF files produced by Microsoft Reporting
Services (Issue #46)

- Odd cross-reference stream containing 3-byte generation number field for this
  16-bit value
- Odd empty hex strings
2023-10-06 10:46:30 -04:00
Michael R Sweet
4f10021e7e
Fix denial-of-service attack when reading corrupt PDF files. 2023-02-03 20:39:04 -05:00
Michael R Sweet
a3f3bbfe11
Fix pdfioFileGetAuthor, etc. APIs (Issue #33) 2022-07-12 18:36:08 -04:00
Michael R Sweet
316b0ad559
Add pdfioFileCreateTemporary function (Issue #29) 2022-05-15 22:52:53 -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
2f0d622873
Save work on resolving PDF loading issues with random PDFs using different encryption methods and line endings. 2021-11-01 21:30:46 -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
208c3419ff
Fix AES-128 writing/encryption. 2021-10-23 20:09:02 -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
493fbca31c
Save work on unit tests for crypto. RC4 and AES are having trouble for some reason... 2021-10-12 17:11:10 -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
0caea44f32
Implement MakeReader/Writer functions. 2021-10-10 23:08:56 -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
37e80d67b1
Use new random number function to generate file IDs. 2021-10-09 23:10:46 -04:00
Michael R Sweet
d5173d14da
Fix some Coverity-detected issues. 2021-10-08 13:49:48 -04:00
Michael R Sweet
43239eaf8a
Add placeholder password callback to support reading of encrypted PDF files in the future. 2021-09-27 08:37:14 -04:00
Michael R Sweet
ba9d03ecac
Update docos. 2021-09-27 08:11:53 -04:00