From 688cd64b13e24defd3928bcbfeb64f1c2f9a0354 Mon Sep 17 00:00:00 2001 From: psoares33 Date: Tue, 7 Oct 2008 22:05:32 +0000 Subject: [PATCH] A fix to take care of broken PDFs that have whitespaces after "stream" before the LF. git-svn-id: svn://svn.code.sf.net/p/itextsharp/code/trunk@14 820d3149-562b-4f88-9aa4-a8e61a3485cf --- src/core/iTextSharp/text/pdf/PdfReader.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/core/iTextSharp/text/pdf/PdfReader.cs b/src/core/iTextSharp/text/pdf/PdfReader.cs index f565c17..55ea1ea 100644 --- a/src/core/iTextSharp/text/pdf/PdfReader.cs +++ b/src/core/iTextSharp/text/pdf/PdfReader.cs @@ -1521,7 +1521,11 @@ namespace iTextSharp.text.pdf { int pos = tokens.FilePointer; // be careful in the trailer. May not be a "next" token. if (tokens.NextToken() && tokens.StringValue.Equals("stream")) { - int ch = tokens.Read(); + //skip whitespaces + int ch; + do { + ch = tokens.Read(); + } while (ch == 32 || ch == 9 || ch == 0 || ch == 12); if (ch != '\n') ch = tokens.Read(); if (ch != '\n')