Skip to content

Commit

Permalink
Fix #85
Browse files Browse the repository at this point in the history
  • Loading branch information
hhrutter committed Jun 2, 2019
1 parent f9a4092 commit 33da2dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions pkg/api/process_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"strings"
"testing"

PDFCPULog "github.com/hhrutter/pdfcpu/pkg/log"
pdf "github.com/hhrutter/pdfcpu/pkg/pdfcpu"
"github.com/hhrutter/pdfcpu/pkg/pdfcpu/validate"
)
Expand Down Expand Up @@ -1824,3 +1825,23 @@ func TestAcroformDemoPDF(t *testing.T) {
}

}

// Enable this test for debugging of a specicif file.
func XTestValidateCommand(t *testing.T) {

PDFCPULog.SetDefaultTraceLogger()
//PDFCPULog.SetDefaultParseLogger()
PDFCPULog.SetDefaultReadLogger()
PDFCPULog.SetDefaultValidateLogger()
PDFCPULog.SetDefaultOptimizeLogger()
PDFCPULog.SetDefaultWriteLogger()

config := pdf.NewDefaultConfiguration()
config.ValidationMode = pdf.ValidationRelaxed

_, err := Process(ValidateCommand("testdata/test.pdf", config))
if err != nil {
t.Fatalf("TestValidateCommand: %v\n", err)
}

}
2 changes: 1 addition & 1 deletion pkg/pdfcpu/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -1063,7 +1063,7 @@ func buildXRefTableStartingAt(ctx *Context, offset *int64) error {

log.Read.Printf("line: <%s>\n", line)

if line != "xref" {
if strings.TrimSpace(line) != "xref" {

log.Read.Println("buildXRefTableStartingAt: found xref stream")
ctx.Read.UsingXRefStreams = true
Expand Down

0 comments on commit 33da2dd

Please sign in to comment.