コード例 #1
0
ファイル: PdfReader.cs プロジェクト: Kwesoft/Pdf
        public PdfTrailer ReadTrailer()
        {
            var eofPos = _document.FindReverse(_document.Keywords.EOFLine);

            var startxrefPos  = _document.FindReverse(_document.Keywords.StartXRefLine, eofPos);
            var startxrefData = _document.Encoding.GetString(_document.Read(startxrefPos + 11, eofPos - (startxrefPos + 11)));

            var trailerPos = _document.FindReverse(_document.Keywords.TrailerLine, startxrefPos) + 1;
            var result     = new PdfTrailer
            {
                Offset = trailerPos,
                Length = eofPos - trailerPos,
                CrossReferenceTableOffset = int.Parse(startxrefData),
                Document = _document
            };

            result.TrailerDictionary = _ReadDictionary(trailerPos + 8, result);
            return(result);
        }
コード例 #2
0
 internal static int FindReverse(this IEditablePdfDocument document, byte[] lookFor, int start) => document.FindReverse(lookFor.Length, w => w.ByteEquals(lookFor), start);
コード例 #3
0
 internal static int FindReverse(this IEditablePdfDocument document, byte[] lookFor) => document.FindReverse(lookFor, document.Length - 1);
コード例 #4
0
 internal static int FindReverse(this IEditablePdfDocument document, int windowSize, Func <byte[], bool> matches) => document.FindReverse(windowSize, matches, document.Length - 1);