本文整理匯總了C#中iTextSharp.text.pdf.PRTokeniser.Seek方法的典型用法代碼示例。如果您正苦於以下問題:C# PRTokeniser.Seek方法的具體用法?C# PRTokeniser.Seek怎麽用?C# PRTokeniser.Seek使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類iTextSharp.text.pdf.PRTokeniser
的用法示例。
在下文中一共展示了PRTokeniser.Seek方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ReadObjStm
virtual protected internal void ReadObjStm(PRStream stream, IntHashtable map) {
if (stream == null) return;
int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
int n = stream.GetAsNumber(PdfName.N).IntValue;
byte[] b = GetStreamBytes(stream, tokens.File);
PRTokeniser saveTokens = tokens;
tokens = new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(b)));
try {
int[] address = new int[n];
int[] objNumber = new int[n];
bool ok = true;
for (int k = 0; k < n; ++k) {
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
ok = false;
break;
}
objNumber[k] = tokens.IntValue;
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
ok = false;
break;
}
address[k] = tokens.IntValue + first;
}
if (!ok)
throw new InvalidPdfException(MessageLocalization.GetComposedMessage("error.reading.objstm"));
for (int k = 0; k < n; ++k) {
if (map.ContainsKey(k)) {
tokens.Seek(address[k]);
tokens.NextToken();
PdfObject obj;
if (tokens.TokenType == PRTokeniser.TokType.NUMBER) {
obj = new PdfNumber(tokens.StringValue);
}
else {
tokens.Seek(address[k]);
obj = ReadPRObject();
}
xrefObj[objNumber[k]] = obj;
}
}
}
finally {
tokens = saveTokens;
}
}
示例2: ReadOneObjStm
protected internal PdfObject ReadOneObjStm(PRStream stream, int idx) {
int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
byte[] b = GetStreamBytes(stream, tokens.File);
PRTokeniser saveTokens = tokens;
tokens = new PRTokeniser(b);
try {
int address = 0;
bool ok = true;
++idx;
for (int k = 0; k < idx; ++k) {
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
ok = false;
break;
}
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
ok = false;
break;
}
address = tokens.IntValue + first;
}
if (!ok)
throw new InvalidPdfException(MessageLocalization.GetComposedMessage("error.reading.objstm"));
tokens.Seek(address);
return ReadPRObject();
}
finally {
tokens = saveTokens;
}
}
示例3: ReadOneObjStm
virtual protected internal PdfObject ReadOneObjStm (PRStream stream, int idx) {
int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
byte[] b = GetStreamBytes(stream, tokens.File);
PRTokeniser saveTokens = tokens;
tokens = new PRTokeniser(new RandomAccessFileOrArray(new RandomAccessSourceFactory().CreateSource(b)));
try {
int address = 0;
bool ok = true;
++idx;
for (int k = 0; k < idx; ++k) {
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
ok = false;
break;
}
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TokType.NUMBER) {
ok = false;
break;
}
address = tokens.IntValue + first;
}
if (!ok)
throw new InvalidPdfException(MessageLocalization.GetComposedMessage("error.reading.objstm"));
tokens.Seek(address);
tokens.NextToken();
PdfObject obj;
if (tokens.TokenType == PRTokeniser.TokType.NUMBER) {
obj = new PdfNumber(tokens.StringValue);
}
else {
tokens.Seek(address);
obj = ReadPRObject();
}
return obj;
}
finally {
tokens = saveTokens;
}
}
示例4: ReadObjStm
protected internal void ReadObjStm(PRStream stream, IntHashtable map) {
int first = stream.GetAsNumber(PdfName.FIRST).IntValue;
int n = stream.GetAsNumber(PdfName.N).IntValue;
byte[] b = GetStreamBytes(stream, tokens.File);
PRTokeniser saveTokens = tokens;
tokens = new PRTokeniser(b);
try {
int[] address = new int[n];
int[] objNumber = new int[n];
bool ok = true;
for (int k = 0; k < n; ++k) {
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
ok = false;
break;
}
objNumber[k] = tokens.IntValue;
ok = tokens.NextToken();
if (!ok)
break;
if (tokens.TokenType != PRTokeniser.TK_NUMBER) {
ok = false;
break;
}
address[k] = tokens.IntValue + first;
}
if (!ok)
throw new InvalidPdfException("Error reading ObjStm");
for (int k = 0; k < n; ++k) {
if (map.ContainsKey(k)) {
tokens.Seek(address[k]);
PdfObject obj = ReadPRObject();
xrefObj[objNumber[k]] = obj;
}
}
}
finally {
tokens = saveTokens;
}
}