35
35
using PdfSharpCore . Exceptions ;
36
36
using PdfSharpCore . Internal ;
37
37
using PdfSharpCore . Pdf . Advanced ;
38
- using PdfSharpCore . Pdf . Internal ;
39
38
using PdfSharpCore . Pdf . IO . enums ;
40
39
41
40
namespace PdfSharpCore . Pdf . IO
42
41
{
43
42
/*
44
- Direct and indireckt objects
43
+ Direct and indirect objects
45
44
46
45
* If a simple object (boolean, integer, number, date, string, rectangle etc.) is referenced indirect,
47
46
the parser reads this objects immediatly and consumes the indirection.
@@ -52,7 +51,7 @@ is returned.
52
51
* If a composite object is a direct object, no PdfReference is created and the object is
53
52
parsed immediatly.
54
53
55
- * A refernece to a non existing object is specified as legal, therefore null is returned.
54
+ * A reference to a non existing object is specified as legal, therefore null is returned.
56
55
*/
57
56
58
57
/// <summary>
@@ -1256,16 +1255,7 @@ private PdfTrailer ReadXRefStream(PdfCrossReferenceTable xrefTable)
1256
1255
Debug . Assert ( xrefStream . Stream != null ) ;
1257
1256
//string sValue = new RawEncoding().GetString(xrefStream.Stream.UnfilteredValue,);
1258
1257
//sValue.GetType();
1259
- byte [ ] bytesRaw = xrefStream . Stream . UnfilteredValue ;
1260
- byte [ ] bytes = bytesRaw ;
1261
-
1262
- // HACK: Should be done in UnfilteredValue.
1263
- if ( xrefStream . Stream . HasDecodeParams )
1264
- {
1265
- int predictor = xrefStream . Stream . DecodePredictor ;
1266
- int columns = xrefStream . Stream . DecodeColumns ;
1267
- bytes = DecodeCrossReferenceStream ( bytesRaw , columns , predictor ) ;
1268
- }
1258
+ var bytes = xrefStream . Stream . UnfilteredValue ;
1269
1259
1270
1260
#if DEBUG_
1271
1261
for ( int idx = 0 ; idx < bytes . Length ; idx ++ )
@@ -1351,7 +1341,7 @@ private PdfTrailer ReadXRefStream(PdfCrossReferenceTable xrefTable)
1351
1341
//// (PDF Reference Implementation Notes 15).
1352
1342
1353
1343
int position = ( int ) item . Field2 ;
1354
- objectID = ReadObjectNumber ( position ) ;
1344
+ objectID = ReadObjectNumber ( position ) ;
1355
1345
#if DEBUG
1356
1346
if ( objectID . ObjectNumber == 1074 )
1357
1347
GetType ( ) ;
@@ -1364,7 +1354,7 @@ private PdfTrailer ReadXRefStream(PdfCrossReferenceTable xrefTable)
1364
1354
#if DEBUG
1365
1355
GetType ( ) ;
1366
1356
#endif
1367
- // Add iref for all uncrompressed objects.
1357
+ // Add iref for all uncompressed objects.
1368
1358
xrefTable . Add ( new PdfReference ( objectID , position ) ) ;
1369
1359
1370
1360
}
@@ -1771,44 +1761,6 @@ private class ParserState
1771
1761
public Symbol Symbol ;
1772
1762
}
1773
1763
1774
- private byte [ ] DecodeCrossReferenceStream ( byte [ ] bytes , int columns , int predictor )
1775
- {
1776
- int size = bytes . Length ;
1777
- if ( predictor < 10 || predictor > 15 )
1778
- throw new ArgumentException ( "Invalid predictor." , "predictor" ) ;
1779
-
1780
- int rowSizeRaw = columns + 1 ;
1781
-
1782
- if ( size % rowSizeRaw != 0 )
1783
- throw new ArgumentException ( "Columns and size of array do not match." ) ;
1784
-
1785
- int rows = size / rowSizeRaw ;
1786
-
1787
- byte [ ] result = new byte [ rows * columns ] ;
1788
- #if DEBUG
1789
- for ( int i = 0 ; i < result . Length ; ++ i )
1790
- result [ i ] = 88 ;
1791
- #endif
1792
-
1793
- for ( int row = 0 ; row < rows ; ++ row )
1794
- {
1795
- if ( bytes [ row * rowSizeRaw ] != 2 )
1796
- throw new ArgumentException ( "Invalid predictor in array." ) ;
1797
-
1798
- for ( int col = 0 ; col < columns ; ++ col )
1799
- {
1800
- // Copy data for first row.
1801
- if ( row == 0 )
1802
- result [ row * columns + col ] = bytes [ row * rowSizeRaw + col + 1 ] ;
1803
- else
1804
- {
1805
- // For other rows, add previous row.
1806
- result [ row * columns + col ] = ( byte ) ( result [ row * columns - columns + col ] + bytes [ row * rowSizeRaw + col + 1 ] ) ;
1807
- }
1808
- }
1809
- }
1810
- return result ;
1811
- }
1812
1764
1813
1765
private readonly PdfDocument _document ;
1814
1766
private readonly Lexer _lexer ;
0 commit comments