Skip to content

Commit

Permalink
Fix #736
Browse files Browse the repository at this point in the history
  • Loading branch information
hhrutter committed Nov 23, 2023
1 parent 125cee2 commit b34248d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
1 change: 0 additions & 1 deletion c1.out

This file was deleted.

25 changes: 23 additions & 2 deletions pkg/pdfcpu/read.go
Expand Up @@ -183,10 +183,10 @@ func scanLinesForSingleEol(data []byte, atEOF bool) (advance int, token []byte,
case indCR >= 0 && indLF >= 0:
if indCR < indLF {
// 0x0D ... 0x0A
return indCR + 1, data[0:indCR], nil
return indCR + 2, data[0:indCR], nil
}
// 0x0A ... 0x0D
return indLF + 1, data[0:indLF], nil
return indLF + 2, data[0:indLF], nil

case indCR >= 0:
// We have a full carriage return terminated line.
Expand Down Expand Up @@ -1484,6 +1484,27 @@ func bypassXrefSection(ctx *model.Context, offExtra int64) error {
bb = nil
withinObj = false
}
if strings.HasSuffix(line, ">>stream") {
i := strings.Index(line, "Length ")
s1 := line[i+7:]
var pos int
for j, char := range s1 {
if char < '0' || char > '9' {
pos = j
break
}
}
length, err := strconv.Atoi(s1[:pos])
if err != nil {
return err
}
offset += int64(length + eolCount)
rd, err := newPositionedReader(rs, &offset)
if err != nil {
return err
}
s = bufio.NewScanner(rd)
}
}
return nil
}
Expand Down

0 comments on commit b34248d

Please sign in to comment.