Skip to content

Commit 33da2dd

Browse files
committed
Fix #85
1 parent f9a4092 commit 33da2dd

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

pkg/api/process_test.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"strings"
2626
"testing"
2727

28+
PDFCPULog "github.com/hhrutter/pdfcpu/pkg/log"
2829
pdf "github.com/hhrutter/pdfcpu/pkg/pdfcpu"
2930
"github.com/hhrutter/pdfcpu/pkg/pdfcpu/validate"
3031
)
@@ -1824,3 +1825,23 @@ func TestAcroformDemoPDF(t *testing.T) {
18241825
}
18251826

18261827
}
1828+
1829+
// Enable this test for debugging of a specicif file.
1830+
func XTestValidateCommand(t *testing.T) {
1831+
1832+
PDFCPULog.SetDefaultTraceLogger()
1833+
//PDFCPULog.SetDefaultParseLogger()
1834+
PDFCPULog.SetDefaultReadLogger()
1835+
PDFCPULog.SetDefaultValidateLogger()
1836+
PDFCPULog.SetDefaultOptimizeLogger()
1837+
PDFCPULog.SetDefaultWriteLogger()
1838+
1839+
config := pdf.NewDefaultConfiguration()
1840+
config.ValidationMode = pdf.ValidationRelaxed
1841+
1842+
_, err := Process(ValidateCommand("testdata/test.pdf", config))
1843+
if err != nil {
1844+
t.Fatalf("TestValidateCommand: %v\n", err)
1845+
}
1846+
1847+
}

pkg/pdfcpu/read.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1063,7 +1063,7 @@ func buildXRefTableStartingAt(ctx *Context, offset *int64) error {
10631063

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

1066-
if line != "xref" {
1066+
if strings.TrimSpace(line) != "xref" {
10671067

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

0 commit comments

Comments
 (0)