Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkg/api/test/booklet_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
Copyright 2021 The pdf Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package test

import (
Expand Down
6 changes: 2 additions & 4 deletions pkg/pdfcpu/read.go
Original file line number Diff line number Diff line change
Expand Up @@ -1275,10 +1275,8 @@ func readXRefTable(ctx *Context) (err error) {

// Ensure valid freelist of objects.
// Note: Acrobat 6.0 and later do not use the free list to recycle object numbers.
err = ctx.EnsureValidFreeList()
if err != nil {
return
}
// Not really necessary but call and fail silently so we at least get a chance to repair corrupt free lists.
ctx.EnsureValidFreeList()

log.Read.Println("readXRefTable: end")

Expand Down
12 changes: 6 additions & 6 deletions pkg/pdfcpu/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,9 +523,9 @@ func sortedWritableKeys(ctx *Context) []int {
// After inserting the last object write the cross reference table to disk.
func writeXRefTable(ctx *Context) error {

if err := ctx.EnsureValidFreeList(); err != nil {
return err
}
//if err := ctx.EnsureValidFreeList(); err != nil {
// return err
//}

keys := sortedWritableKeys(ctx)

Expand Down Expand Up @@ -719,9 +719,9 @@ func writeXRefStream(ctx *Context) error {
}

// After the last insert of an object.
if err = xRefTable.EnsureValidFreeList(); err != nil {
return err
}
//if err = xRefTable.EnsureValidFreeList(); err != nil {
// return err
//}

xRefStreamDict.Insert("Size", Integer(*xRefTable.Size))

Expand Down