本文整理汇总了Golang中github.com/yob/pdfreader/fancy.Reader.Seek方法的典型用法代码示例。如果您正苦于以下问题:Golang Reader.Seek方法的具体用法?Golang Reader.Seek怎么用?Golang Reader.Seek使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/yob/pdfreader/fancy.Reader
的用法示例。
在下文中一共展示了Reader.Seek方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: refToken
func refToken(f fancy.Reader) ([]byte, int64) {
tok, p := ps.Token(f)
if len(tok) > 0 && tok[0] >= '0' && tok[0] <= '9' {
ps.Token(f)
r, q := ps.Token(f)
if string(r) == "R" {
f.Seek(p, 0)
tok = f.Slice(int(1 + q - p))
} else {
f.Seek(p+int64(len(tok)), 0)
}
}
return tok, p
}
示例2: xrefRead
// xrefRead() reads the xref table(s) of a PDF file. This is not recursive
// in favour of not to have to keep track of already used starting points
// for xrefs.
func xrefRead(f fancy.Reader, p int) map[int]int {
var back [MAX_PDF_UPDATES]int
b := 0
s := _Bytes
for ok := true; ok; {
back[b] = p
b++
p = xrefSkip(f, p)
f.Seek(int64(p), 0)
s, _ = ps.Token(f)
if string(s) != "trailer" {
return nil
}
s, _ = ps.Token(f)
s, ok = Dictionary(s)["/Prev"]
p = num(s)
}
r := make(map[int]int)
for b != 0 {
b--
f.Seek(int64(back[b]), 0)
ps.Token(f) // skip "xref"
for {
m := tupel(f, 2)
if string(m[0]) == "trailer" {
break
}
ps.SkipLE(f)
o := num(m[0])
dat := f.Slice(num(m[1]) * 20)
for i := 0; i < len(dat); i += 20 {
if dat[i+17] != 'n' {
delete(r, o)
} else {
r[o] = num(dat[i : i+10])
}
o++
}
}
}
return r
}
示例3: eexec
func eexec(rdr fancy.Reader) []byte {
fpos, _ := rdr.Seek(0, 1)
b := fancy.ReadAll(rdr)
cnt := 0
pos := 0
k := 0
for ; cnt < 256 && k < len(b); k++ {
switch b[k] {
case 32, 10, 13, 9:
case '0':
cnt++
default:
cnt = 0
pos = k + 1
}
}
b = b[0:pos]
rdr.Seek(fpos+int64(k), 0)
if hex.IsHex(b[0]) {
b = hex.Decode(string(b))
}
return T1Decrypt(EEXEC_KEY, b)[4:]
}
示例4: Token
func Token(f fancy.Reader) ([]byte, int64) {
again:
c := skipSpaces(f)
if c == 0 {
return []byte{}, -1
}
p := fpos(f) - 1
switch c {
case '%':
skipComment(f)
goto again
case '<', '[', '{':
skipComposite(f)
case '(':
skipString(f)
default:
if skipToDelim(f) != 255 {
f.UnreadByte()
}
}
n := int(fpos(f) - p)
f.Seek(p, 0)
return f.Slice(n), p
}
示例5: xrefSkip
// xrefSkip() queries the start of the trailer for a (partial) xref-table.
func xrefSkip(f fancy.Reader, xref int) int {
f.Seek(int64(xref), 0)
t, p := ps.Token(f)
if string(t) != "xref" {
return -1
}
for {
t, p = ps.Token(f)
if t[0] < '0' || t[0] > '9' {
f.Seek(p, 0)
break
}
t, _ = ps.Token(f)
ps.SkipLE(f)
f.Seek(int64(num(t)*20), 1)
}
r, _ := f.Seek(0, 1)
return int(r)
}
示例6: fpos
func fpos(f fancy.Reader) int64 {
r, _ := f.Seek(0, 1)
return r
}