Commit Graph

1547 Commits

Author SHA1 Message Date
davebrokit
d7e434edaa
#836 Fix UnsupervisedReadingOrder orders 2 blocks on the same row out of order (#841)
* #836 Fix UnsupervisedReadingOrder orders 2 blocks on the same row out of order
Add images for documentation

* Update Documentation: Additional example, Reference to wiki

* Change code formating to C# on documentation

* Fix link in documentation

* Fix Spelling

---------

Co-authored-by: David <David@david>
2024-05-29 22:16:05 +01:00
Richard Webb
d86c2f44f0
Use a fixed list of operations in ReflectionGraphicsStateOperationFac… (#832)
* Use a fixed list of operations in ReflectionGraphicsStateOperationFactory rather than searching via reflection.

* Add a unit test to check that ReflectionGraphicsStateOperationFactory.operations contains all supported graphics operations
2024-05-09 06:57:14 +01:00
BobLd
5a8e6179da Add AndroidSystemFontLister 2024-05-08 19:13:36 +01:00
Richard Webb
995f287e0d
Update the dependencies in UglyToad.PdfPig.Package (#835) 2024-05-07 20:21:04 +01:00
Richard Webb
937793bec7 Update Github actions in the CI build 2024-05-06 17:38:00 +01:00
Richard Webb
2cf8762128 Conditionalize the formatter based serialization bits in InvalidFontFormatException 2024-05-06 17:37:15 +01:00
Jason Nelson
c6a7a2d0a2
Improve Code Quality (#831)
* Introduce globals

* Spanify TransformationMatrix.FromArray

* Eliminate allocation in GeometryExtensions.ParametricPerpendicularProjection

* Eliminate allocation in CrossReferenceTablePart.Parse

* Optimize Adam7 (eliminate virtual calls)

* Spanify QuadPointsQuadrilateral.Points to eliminate virtual calls

* Eliminate allocation in PdfRectangle.Normalize

* Format TransformMatrix

* Pass TransformationMatrix  by reference in TransformationMatrix.Multiply

* Seal NoTextTokenWriter
2024-05-06 07:38:06 +01:00
Richard Webb
b6e0305a1c Fix a compile error in the Examples project 2024-05-05 11:01:28 +01:00
Jason Nelson
da44e1a540
Improve code quality (#825)
* 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)
2024-05-03 07:36:19 +01:00
Jason Nelson
7f42a8d60c
Reduce Allocations (#821)
* Introduce ValueStringBuilder

* Make NumericTokenizer and PlanTextTokenizer thread-safe

* Replace ListPool with ArrayPoolBufferWriter

* Seal ITokenizer classes

* Eliminate array allocation in Type1ArrayTokenizer

* Eliminate array allocation in AcroFormFactory

* Eliminate StringBuilder allocation in Page.GetText

* Optimize PdfSubpath.ToLines

* Eliminate various allocations when parsing CompactFontFormat

* Remove unused FromOctalInt helper

* Ensure Pdf.Content is not null

* Write ASCII values directly to stream (avoiding allocations)

* Avoid encoding additional ASCII values

* Eliminate allocations in TokenWriter.WriteName

* Eliminate allocation in TokenWriter.WriteNumber

* Add System.Memory reference to Fonts
2024-04-28 18:55:58 +01:00
Jason Nelson
1ef2e127a6
Improve Code Quality (#818)
* 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
2024-04-18 19:58:40 +01:00
Jason Nelson
0f7077b257 Improve stream overrides 2024-04-12 07:42:19 +01:00
Jason Nelson
90e07bc639 Eliminate allocations in PatternParser, PdfFunctionParser, and ShadingParser 2024-04-12 07:42:19 +01:00
Jason Nelson
c3a2e8c08f Rename TryGetMemory -> TryGetBytesAsMemory 2024-04-12 07:42:19 +01:00
Jason Nelson
fc1a41ffbb Remove unused StreamHelper methods 2024-04-12 07:42:19 +01:00
Jason Nelson
a5e9b438cc Eliminate allocation in BasePageFactory 2024-04-12 07:42:19 +01:00
Jason Nelson
215e12543c Format ImageHeader 2024-04-12 07:42:19 +01:00
Jason Nelson
a68febfa95 React to IPdfImage change 2024-04-12 07:42:19 +01:00
Jason Nelson
49c155cca2 Add IPdfImage.RawBytes 2024-04-12 07:42:19 +01:00
Jason Nelson
bd95adf4bc Optimize RunLengthFilter 2024-04-12 07:42:19 +01:00
Jason Nelson
b498f5a076 Eliminate allocation in AsciiHexDecodeFilter 2024-04-12 07:42:19 +01:00
Jason Nelson
d85ea4f95d Update Filters to operate over Spans 2024-04-12 07:42:19 +01:00
Jason Nelson
0efa68a8e4 Optimize Crc32 calculations 2024-04-12 07:42:19 +01:00
Jason Nelson
4ad6bfc74e [Fonts] Add Encoding.GetString(ReadOnlySpan<byte>) polyfill 2024-04-12 07:42:19 +01:00
Jason Nelson
ce5dc7c1a1 Eliminate byte[] allocation in RC4 2024-04-12 07:42:19 +01:00
Jason Nelson
fba5b60718 [Fonts] Add Stream.Write(Span<byte>) polyfill 2024-04-12 07:42:19 +01:00
Jason Nelson
e01bf5e849 Spanify IInputBytes 2024-04-12 07:42:19 +01:00
Jason Nelson
775d1343ae Spanify PngBuilder 2024-04-12 07:42:19 +01:00
Jason Nelson
435da86a25 Make QuadPointsQuadrilateral a readonly struct 2024-04-12 07:42:19 +01:00
Jason Nelson
8babdfdda5 Reduce ColorSpaceDetails virtual calls 2024-04-12 07:42:19 +01:00
Jason Nelson
4fcc5c6c57 Eliminate a few allocations in ColorSpace transformers 2024-04-12 07:42:19 +01:00
Jason Nelson
6d54355754 Spanify filters 2024-04-12 07:42:19 +01:00
BobLd
2d6cb1aa0c Properly implement Quadtratic and Cubic bezier-curves and use Quadtratic in CalculatePath to fix #625 2024-04-05 11:33:59 +01:00
Jason Nelson
f62929eb7c
Spanify work 1 (#812)
* Add GetString(ReadOnlySpan<byte>) polyfill

* Add ArrayPoolBufferWriter

* Use Utf8.IsValid & char.IsAsciiHexDigit on NET8.0+

* Optimize HexTokenizer

* Eliminate various Tuple allocations

* Eliminate List allocation in CrossReferenceTable

* Eliminate various allocations in Ascii85Filter

* Spanify HexToken

* Spanify Palette

* Spanify various Cmap & font methods

* Spanify Type1Charstring classes

* Spanify PdfDocEncoding.TryConvertBytesToString

* Spanify OctalHelpers.FromOctalDigits

* Add missing braces

* React to HexToken.Byte type changes

* Cleanup

* [Tests] React to span changes

* Add ArgumentNullException check back to Type1CharstringDecryptedBytes

* Remove unsafe code

* Seal HexToken

* Avoid allocation when passing an empty span
2024-04-01 09:18:01 +01:00
BobLd
e789691100
Fix #807 (#808) 2024-03-23 19:25:40 +00:00
Jason Nelson
69e2b7bb08
Improve Code Quality 3 (#805)
* Throw when trying to inverse a matrix with a determinant of 0

* Optimize Hex.GetString on .NET

* Updates tests for Matrix3x3.Inverse() change

* Eliminate allocation in InternalStringExtensions

* Use vectorized Span.Fill method

* Eliminate various string allocations when parsing numbers

* Remove unused using statements

* Fix Matrix3x3 Equals nullability
2024-03-17 21:13:32 +00:00
Jason Nelson
a412a239be
Enable nullable annotations (#803)
* 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)
2024-03-17 18:51:40 +00:00
BobLd
bf6c519483 Make AnnotationProvider public 2024-03-16 12:50:26 +00:00
BobLd
8163d9ff89 Update run_integration_tests.yml 2024-03-16 12:44:03 +00:00
Jason Nelson
95f0459900 Prefer is null to == null
ensures that an equals overload isn't use, and we don't compare structs
2024-03-16 12:37:51 +00:00
Jason Nelson
d19e6ad510 Use collection expressions 2024-03-16 12:37:51 +00:00
Jason Nelson
524b235502 Enable nullable annotations 2024-03-16 12:37:51 +00:00
Jason Nelson
9859c2672b Use switch expressions 2024-03-16 12:37:51 +00:00
Jason Nelson
dca11253a0 Spanify Crc32 2024-03-16 12:37:51 +00:00
Jason Nelson
77705bbd67 Spanify Adler32Checksum 2024-03-16 12:37:51 +00:00
Ian McCubbin
9056d2bdff Removed mistaken bracket in text replace operation 2024-03-16 07:58:32 +00:00
Jason Nelson
321f321e53 Replace obsolete netcoreapp test target with net471 2024-03-16 07:40:17 +00:00
Jason Nelson
1d2777d59a [Tests] Enable implict usings 2024-03-16 07:40:17 +00:00
Jason Nelson
4e1c7930b7 Update xunit 2024-03-16 07:40:17 +00:00
Jason Nelson
d413d24d96 Drop net6.0 from tests 2024-03-15 13:10:25 +00:00