* Support not finding the Pages dictionary in lenient mode and support Kids object not referencing a page object in lenient mode
---------
Co-authored-by: Arnaud TAMAILLON <arnaud.tamaillon@younited-credit.fr>
* Avoid ToArray() in memoryFactory
* Seal and update IFilters to return ReadOnlyMemory<byte>
* Fix filter tests
* Seal and update IFilters to return ReadOnlyMemory<byte>
* Avoid encoding ASCII in more cases
* Make Space a const
* Use WriteWhiteSpace extension to eliminate possible virtual call
* Use ASCII when encoding constrained character subset
* Simplify pragmas
* Revert Whitespace rename
* Fix using statement order
* Remove obsolete serialization support on .NET
* Remove obsolete serialization support on .NET (part 2)
* Make AdobeFontMetricsLigature a struct
* Make AdobeFontMetricsCharacterSize a struct
* Eliminate allocation in CompactFontFormatData
* Pass TransformationMatrix by reference
* Seal Encoding classes
* Make SubTableHeaderEntry a readonly struct
* Introduce StringSplitter and eliminate various allocations in GlyphListFactory
* Eliminate a few substring allocations
* Use char overload on StringBuilder
* Eliminate virtual calls on stringIndex
* Optimize ReadHelper ReadLong and ReadInt methods
* Add additional readonly annotations to PdfRectangle
* Optimize NameTokenizer
* Eliminate allocation in TrueTypeGlyphTableSubsetter
* Use empty arrays
* Eliminate allocations in OperationWriteHelper.WriteHex
* Use simplified DecryptCbc method on .NET 6+
* Fix windows-1252 encoding not working on net6.0 and 8.0
* Update int buffers to exact unsigned max length and eliminate additional byte allocation
* Fix typo
* Remove unused constant
* Enable nullable annotations
* Remove unused Jetbrain annotations
* Ensure system using statements are first
* Improve nullability annotations
* Annotate encryptionDictionary is non-null when IsEncrypted is true
* Disable nullable for PdfTokenScanner.Get
* Improve nullability annotations for ObjectLocationProvider.TryGetCached
* Revert changes to RGBWorkingSpace
* Update UglyToad.PdfPig.Package with new framework targets (fixes nightly builds)
* Made interfaces and classes public
* Made NamedDestinations public and fixed namespace
* Fixed NamedDestinationsProvider namespace
* Expose more internal classes as public
* Update PublicApiScannerTests
* Make setters internal
if skip missing fonts is set we want to read the file
as much as possible so we will also skip any missing
xobjects like images, forms or postscript code
* Add Named Destinations to Catalog so that bookmarks and links can access
them.
The named destinations require access to page nodes, so created Pages object
that is made using PagesFactory (which contains the page-related code from
Catalog).
* Further implementation of destinations:
- Implement NamedDestinations in AnnotationProvider, so that we can look
up named destinations for annotations and turn them into explicit destinations.
Reused existing code inside BookmarksProvider to get destinations/actions.
- Added GoToE action
- According to the PDF reference, destinations are also required for
external destinations and hence for ExternalBookmarkNode. This allows us
to push up DocumentBookmarkNode.Destination to BookmarkNode.
* Implemented stateful appearance streams and integration test
* Added AppearanceStream to public API because it is used in the (public)
Annotation constructor
* After #552, must push down ExplicitDestination do DocumentBookmarkNode since it
does not apply to UriBookmarkNode.
* Added actions, which fits the PDF model better and works well with the
new bookmarks code (after PR #552)
* Rename Action to PdfAction + removed unused using in ActionProvider.cs
---------
Co-authored-by: mvantzet <mark@radialsg.com>
The initial transformation matrix was incorrect, as it translated by the cropbox width/height
instead of by the cropbox left/bottom offsets. Also, it did not translate the results back into
the 1st quadrant so that (0,0) would (again) be the lower left corner origin for the cropped area.
Added unit tests in new file ContentStreamProcessorTests.
EFFECTIVE CHANGES:
- The coordinates used for letters etc. are different now for rotated and/or cropped pages,
but as those were not very consistent anyway this is probably OK.
- The Page Size (A4, A3, Custom, etc.), Width and Height are now determined by the CropBox,
not by the MediaBox; the CropBox ultimately determines what you see on screen and is printable.
If no cropbox is defined in the PDF, it is set to the MediaBox; so in that case it is
backwards compatible with the old code.
- The Page MediaBox and CropBox properties are no longer rotated according to Page.Rotation.
The Page Width and Height do take rotation into account (kept it backward compatible).
constructor arguments. Kept property Color, which contains either StrokeColor (if rendering mode is Stroke)
or FillColor (for all other rendering modes).
In PdfPageBuilder opted for default text rendering mode "Fill" which seems like a sensible default.
this doesn't fix the reported issue since the pdf itself is corrupted on page 8 however it will
allow recovery in some scenarios where text content isn't important.
also adds more informative error when stream unintentionally passed with non zero offset
For case when root nod has reference to page the order will be incorrect.
The case if root node has reference
[2 0 R 3 0 R 10 0 R]
Where 2 0 R is intermediate node containing page 1,2,3
Where 3 0 R is intermediate node containing page 4,5,6
Where 10 0 R is page 7
without that fix 7 page will in array as page 1