pdfcpu / pdfcpu

A PDF processor written in Go.

Home Page:http://pdfcpu.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

About the version of xRefTable

jimbirthday opened this issue · comments

Thank you for submitting a possible bug!

Please ensure the following:

  • Your issue is based on the latest commit
  • State your OS and OS version - windows11

this my pdf file info

PDF version: | 1.7

this my code

	pdfFile := "1.pdf"

	// 将PDF页面渲染为图像
	err := api.ExtractImagesFile(pdfFile, "./1.png", []string{"1"}, &model.Configuration{
		WriteXRefStream: false,
	})
	if err != nil {
		fmt.Fprintf(os.Stderr, "Extraction error: %v\n", err)
		return
	}

log

Extraction error: Read: xRefTable failed: parseTrailerDict: PDF1.4 conformant reader: found incompatible version: 1.7

image
change WriteXRefStream to true, result same

Did you ensure your input file passes validation?
pdfcpu val in.pdf

This file's trailer seems to be corrupted somehow.
Working on the assumption that you can open this file with A.Preview or A.Reader..
If you can share the file I will look into this and provide a fix.
Thank you!