Commit Graph

1723 Commits

Author SHA1 Message Date
EliotJones
daaac9350d writer util did not follow reference links #1032
when copying various dictionaries from a source document
to the builder any indirect references in the source document
would throw because the code expected the dictionary token
directly. now we follow the list of indirect references until we
find a non-indirect leaf token. also changes the exception type.
2025-07-06 07:15:35 +01:00
EliotJones
f099dd5827 add test coverage to stream scanning 2025-07-06 07:13:55 +01:00
EliotJones
0586713da3 skip comments in pdf objects streams #926
the file provided in issue #926 contains the following syntax
in pdf object streams:

```
% 750 0 obj
<< >>
```

currently we read the comment token and skip the rest
however this producer is writing nonsense to the stream.
comment tokens are only valid outside streams in pdf files
so we align to the behavior of pdfbox here by skipping the
entire line containing a comment inside a stream which fixes
parsing this file.
2025-07-06 07:13:55 +01:00
xufeng
62612588c8 Fix bug in PngFromPdfImageFactory where softmask is wrongly referenced. 2025-07-06 07:10:11 +01:00
BobLd
bf664c3f0b Use ReadOnlyMemory<byte> in ShowText operators and implement MoveToNextLineShowTextWithSpacing parsing 2025-06-29 14:27:14 +01:00
BobLd
6a50160e65 Prevent RunLengthFilter malicious OOM 2025-06-29 13:57:01 +01:00
BobLd
73ce5bbb73 Make classes related to page content parsing public 2025-06-28 13:17:40 +01:00
BobLd
d1d79b0b4c Check ColorSpace token as dictionary and fix issue #1061 2025-06-25 19:20:02 +01:00
BobLd
89abf6de54 Skip creating IndirectReference in CrossReferenceTablePartBuilder when generationNumber is more than 65,535
Some checks failed
Build and test / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / Check latest commit (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
2025-06-01 14:16:22 +01:00
BobLd
24431b1f9f Optimize internal representation of IndirectReference 2025-06-01 12:02:29 +01:00
BobLd
8f9194c9a4 Miscellaneous minor changes 2025-05-31 23:02:46 +01:00
BobLd
fe3d15d5db Add extension method to get Memory<byte> from MemoryStream, attempting to do it without allocation and update CMapParser 2025-05-30 13:02:55 +01:00
BobLd
b5b58434e9 Make the Diacritics class public for use in external StreamProcessors 2025-05-30 09:25:03 +01:00
BobLd
d9b3891eb3 Do not throw if the Mask dictionary contains a ColorSpace key 2025-05-30 07:53:25 +01:00
BobLd
4bdb85d1ff Modernise PngPredictor and refactor LzwFilter and FlateFilter to reduce memory allocation 2025-05-29 22:43:46 +01:00
BobLd
f84f2aceec Improve memory allocation by changing IFilter.Decode() signature to use Memory<byte> instead of ReadOnlyMemory/ReadOnlySpan 2025-05-29 12:41:50 +01:00
BobLd
2b54a546d3 Check for infinite recursion in ObjectLocationProvider.TryGetOffset() and fix #1050 2025-05-28 20:24:31 +01:00
BobLd
5b566b53da Only reset missed attempts count if table is found in CrossReferenceParser.Parse() and fix #1047 2025-05-27 20:57:38 +02:00
BobLd
ca9f70ffb0 Skip control chars in CoreTokenScanner.MoveNext() and fix #1048 2025-05-27 20:57:38 +02:00
BobLd
67d3dde04a Handle TrueType case in CidFontFactory where the font is CFF, implement missing members in PdfCidCompactFontFormatFont and fix #554
Some checks failed
Build and test / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / Check latest commit (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
2025-05-19 00:27:51 +01:00
BobLd
e4d7805a1f Add test to ensure #822 is fixed 2025-05-18 22:32:07 +01:00
BobLd
6911f31b49 Try to repair xref offset by looking for all startxref and fix #1040
Some checks are pending
Build and test / build (push) Waiting to run
Build and test [MacOS] / build (push) Waiting to run
Run Integration Tests / build (push) Waiting to run
2025-05-18 17:32:27 +01:00
BobLd
bf7c3c01d0 Fix bug introduced in #1039
Some checks failed
Build and test / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
2025-05-13 18:44:31 +01:00
ricflams
c3c477a2ba Bugfix and optimize GetStartXrefPosition
The bugfix was the important part but the optimization is pretty nice too.

- Bugfix: If startxref was found so far back (eg in the very beginning which can be the case for Linearized PDFs) that we ended up setting actualStartOffset to 0 then the loop would exit immediately without actually searching that part.
- Optimization: GetStartXrefPosition would search for startxref in the last 2048 bytes and then double that search-range (looking back 4096, 8192, etc bytes) to look for startxref until the entire file was searched. This was rather inefficient since each step would search the same parts over and over again. This has been changed to properly search (still increasingly larger) chunks that doesn't overlap. On a test of 5000 PDFs that reduced their load-time by 10%.
- Change: No need for the exception to say that startxref couldn't be found "in the last 2048 characters" since the entire file was searched anyway.
2025-05-13 18:21:31 +01:00
BobLd
4dab2ef239 Add early support for Stencil masking, rename SoftMaskImage property into MaskImage and make sure IsInlineImage is true for InlineImage
Some checks failed
Build and test / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
2025-05-11 16:05:55 +01:00
BobLd
0bed135bad Make sure the value of the ImageMask / Im token is check in ColorSpaceDetailsParser 2025-05-11 14:34:40 +01:00
BobLd
47584716ec Add support for MacCatalyst in SystemFontFinder
Some checks failed
Build and test / build (push) Has been cancelled
Build and test [MacOS] / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / Check latest commit (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
2025-04-24 19:17:48 +01:00
BobLd
afdd1f8924 Fix issue #1013 2025-04-20 18:03:04 +01:00
BobLd
580858348b Seal PdfSubpath class and IPathCommand implementations, fix Close.GetHashCode() and fix #1027 2025-04-12 16:39:48 +01:00
BobLd
24902f1839 Update README.md 2025-04-06 12:06:36 +01:00
BobLd
87f5735b26 Refactor AesEncryptionHelper and check for sting length when using < net8 2025-04-06 12:04:24 +01:00
BobLd
eeac910e44 Fix CanFilterClippedLetters() failing on MacOS because font is not available 2025-04-06 12:04:24 +01:00
BobLd
5439c07ef5 Make ExplicitDestinationType a byte a fix CanCreateDocumentWithOutline() failing test 2025-04-06 12:04:24 +01:00
BobLd
b8bd40e486 Create build_and_test_macos.yml 2025-04-06 12:04:24 +01:00
BobLd
4fbcc112d3 Fix bug where FormXObject bbox needs to be normalised 2025-03-30 22:01:12 +01:00
BobLd
ede77c20f5
Update README.md 2025-03-30 11:39:47 +01:00
BobLd
5fb36d452f Handle SoftMask 2025-03-30 10:33:27 +01:00
BobLd
74d61bd985 Fix PatternColor Equals() method and fix #1016 2025-03-26 19:48:51 +00:00
Matěj Štágl
ba8e1e1b45 fix #1017
fix test name
2025-03-26 18:59:39 +00:00
BobLd
0754e7f003 Implement clipping in ProcessFormXObject()
Some checks failed
Build and test / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / Check latest commit (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
2025-03-23 21:18:29 +00:00
BobLd
306642a234 Add SetStrokeDetails() and SetFillDetails() to PdfPath and tidy up ContentStreamProcessor 2025-03-23 20:07:43 +00:00
BobLd
204f488ebf Improve Jpeg2000Helper to support J2K codec and add test
Some checks failed
Build and test / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
2025-03-09 14:05:05 +00:00
BobLd
a4a0fe220a Bump version to 0.1.11-alpha001
Some checks are pending
Build and test / build (push) Waiting to run
Run Integration Tests / build (push) Waiting to run
2025-03-08 13:42:57 +00:00
BobLd
f1f27a63e1 Update run_integration_tests.yml 2025-03-08 13:15:40 +00:00
BobLd
d36e9a900f version 0.1.10 2025-03-08 13:00:43 +00:00
BobLd
1b3c7bd355 Better handle integer overflow in DocstrumBoundingBoxes
Some checks failed
Build and test / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
Nightly Release / tests (push) Has been cancelled
Nightly Release / Check latest commit (push) Has been cancelled
Nightly Release / build_and_publish_nightly (push) Has been cancelled
2025-03-02 18:29:21 +00:00
BobLd
67d8f56366 Do not throw exception when lenient parsing in GetExtendedGraphicsStateDictionary() and improve StackDictionary.TryGetValue() to not throw on empty 2025-03-02 11:51:26 +00:00
BobLd
f26e7d90a3 Pass IFilterProvider to IFilter.Decode() and handle null in PdfExtensions.Resolve()
Some checks failed
Build and test / build (push) Has been cancelled
Run Integration Tests / build (push) Has been cancelled
2025-02-23 09:37:25 +00:00
BobLd
d973e03206 Resolve image data (implementation from @kasperdaff)
Some checks are pending
Build and test / build (push) Waiting to run
Run Integration Tests / build (push) Waiting to run
2025-02-22 20:58:17 +00:00
BobLd
c4a235fb62 Update Microsoft NuGet packages for UglyToad.PdfPig.Package
Some checks are pending
Build and test / build (push) Waiting to run
Run Integration Tests / build (push) Waiting to run
2025-02-22 12:55:11 +00:00