Skip to content
Browse files

Fix #94

  • Loading branch information...
hhrutter committed Jul 21, 2019
1 parent 3b47039 commit 18994fd6776f425631cc195b28db99fd91d7c76f
Showing with 20 additions and 22 deletions.
  1. +11 −10
  2. +6 −3 pkg/pdfcpu/writeObjects.go
  3. +3 −9 pkg/pdfcpu/xreftable.go
  4. BIN resources/gridimg.png
@@ -1,4 +1,4 @@
# pdfcpu: a golang pdf processor
# pdfcpu: a Go PDF processor

[![Build Status](](
@@ -17,15 +17,15 @@ It provides both an API and a CLI. Supported are all versions up to PDF 1.7 (ISO
This is an effort to build a comprehensive PDF processing library from the ground up written in Go. Over time pdfcpu aims to support the standard range of PDF processing features and also any interesting use cases that may present themselves along the way.

<p align="center">
<kbd><img src="resources/gridpdf.png" height="150"></kbd>&nbsp;
<kbd><img src="resources/wmi1abs.png" height="150"></kbd>&nbsp;
<kbd><img src="resources/nup9pdf.png" height="150"></kbd>&nbsp;
<kbd><img src="resources/stt31.png" height="150"></kbd><br><br>
<kbd><img src="resources/sti.png" height="150"></kbd>&nbsp;
<kbd><a href=""><img src="resources/gridpdf.png" height="150"></a></kbd>&nbsp;
<kbd><a href=""><img src="resources/wmi1abs.png" height="150"></a></kbd>&nbsp;
<kbd><a href=""><img src="resources/nup9pdf.png" height="150"></a></kbd>&nbsp;
<kbd><a href=""><img src="resources/stt31.png" height="150"></a></kbd><br><br>
<kbd><a href=""><img src="resources/sti.png" height="150"></a></kbd>&nbsp;
<kbd><img src="resources/hold3.png" height="150"></kbd>&nbsp;
<kbd><img src="resources/wmi4.png" height="150"></kbd>&nbsp;<br><br>
<kbd><img src="resources/stp.png" height="150"></kbd>&nbsp;
<kbd><img src="resources/gridimg.png" height="150"></kbd>
<kbd><a href=""><img src="resources/wmi4.png" height="150"></a></kbd>&nbsp;<br><br>
<kbd><a href=""><img src="resources/stp.png" height="150"></a></kbd>&nbsp;
<kbd><a href=""><img src="resources/gridimg.png" height="150"></a></kbd>

## Focus
@@ -64,7 +64,8 @@ The main focus lies on strong support for batch processing and scripting via a r
### GoDoc

* [pdfcpu package](
* [pdfcpu api](
* [pdfcpu API](
* [pdfcpu CLI](

## Status

@@ -204,9 +204,12 @@ func writeObject(ctx *Context, objNumber, genNumber int, s string) error {

w := ctx.Write

// Cleanup entry (nexessary for split command)
entry, _ := ctx.FindTableEntry(objNumber, genNumber)
entry.Compressed = false
// Cleanup entry (necessary for split command)
// TODO This is not the right place to check for an existing obj since we maybe writing NULL.
entry, ok := ctx.FindTableEntry(objNumber, genNumber)
if ok {
entry.Compressed = false

// Set write-offset for this object.
@@ -266,17 +266,11 @@ func (xRefTable *XRefTable) FindTableEntryLight(objNr int) (*XRefTableEntry, boo
func (xRefTable *XRefTable) FindTableEntry(objNr int, genNr int) (*XRefTableEntry, bool) {

//fmt.Printf("FindTableEntry: obj#:%d gen:%d \n", objNumber, generationNumber)

entry, found := xRefTable.Find(objNr)
// if found && entry == nil {
// fmt.Printf("FindTableEntry(%d,%d) finds entry = nil!\n", objNr, genNr)
// }

if found && *entry.Generation == genNr {
return entry, found
if !found || *entry.Generation != genNr {
return nil, false

return nil, false
return entry, found

// FindTableEntryForIndRef returns the XRefTable entry for given indirect reference.
BIN -382 KB (16%) resources/gridimg.png
Binary file not shown.

0 comments on commit 18994fd

Please sign in to comment.
You can’t perform that action at this time.