Skip to content

Api: merge pdf error #850

@iyichen

Description

@iyichen

issue

api.MergeCreateFile() error: validatePageContents: page content must be stream dict or array

description

I'm using api.MergeCreateFile() to merge pdf files, I found it will report an error when a pdf file contains blank pages, and after I delete the blank pages, it works fine.
However when I use QuickLook open a pdf file and append a blank page, MergeCreateFile() works fine. So I feel confused why this is happening.

code

package main

import (
	"fmt"
	"github.com/pdfcpu/pdfcpu/pkg/api"
)

func main() {
	err := api.MergeCreateFile([]string{"with_blank_page.pdf", "without_blank_page.pdf"}, "merge.pdf", false, nil)
	fmt.Println(err)
}

  • OS: macOs 14.1.2
  • GO: go1.20.3

PDF files:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions