pdfcpu / pdfcpu

A PDF processor written in Go.

Home Page:http://pdfcpu.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`pdfcpu images list` command can not get output

roccomao opened this issue · comments

Take file ./pkg/testdata/testImage.pdf as an example, pdfcpu images list testImage.pdf get output as follows:

pages: all
unexpected panic attack: runtime error: index out of range [0] with length 0

But when we extract the images by pdfcpu extract -m i testImage.pdf ., it can be successful. By switching to detailed logs, the output is as follows (pdfcpu images list -vv testImage.pdf):

    ...... ......
    ...... ......
Fatal: unexpected panic attack: runtime error: index out of range [0] with length 0

github.com/pdfcpu/pdfcpu/pkg/cli.Process.func1
	/Users/horstrutter/Documents/go/pdfcpu/pkg/cli/process.go:28
runtime.gopanic
	/usr/local/go/src/runtime/panic.go:770
runtime.goPanicIndex
	/usr/local/go/src/runtime/panic.go:114
github.com/pdfcpu/pdfcpu/pkg/pdfcpu.ImageObjNrs
	/Users/horstrutter/Documents/go/pdfcpu/pkg/pdfcpu/extract.go:37
github.com/pdfcpu/pdfcpu/pkg/pdfcpu.ExtractPageImages
	/Users/horstrutter/Documents/go/pdfcpu/pkg/pdfcpu/extract.go:404
github.com/pdfcpu/pdfcpu/pkg/pdfcpu.Images
	/Users/horstrutter/Documents/go/pdfcpu/pkg/pdfcpu/image.go:49
github.com/pdfcpu/pdfcpu/pkg/pdfcpu.ListImages
	/Users/horstrutter/Documents/go/pdfcpu/pkg/pdfcpu/image.go:223
github.com/pdfcpu/pdfcpu/pkg/cli.listImages
	/Users/horstrutter/Documents/go/pdfcpu/pkg/cli/list.go:224
github.com/pdfcpu/pdfcpu/pkg/cli.ListImagesFile
	/Users/horstrutter/Documents/go/pdfcpu/pkg/cli/list.go:247
github.com/pdfcpu/pdfcpu/pkg/cli.ListImages
	/Users/horstrutter/Documents/go/pdfcpu/pkg/cli/cli.go:275
github.com/pdfcpu/pdfcpu/pkg/cli.processImages
	/Users/horstrutter/Documents/go/pdfcpu/pkg/cli/process.go:175
github.com/pdfcpu/pdfcpu/pkg/cli.Process
	/Users/horstrutter/Documents/go/pdfcpu/pkg/cli/process.go:35
main.process
	/Users/horstrutter/Documents/go/pdfcpu/cmd/pdfcpu/process.go:150
main.processListImagesCommand
	/Users/horstrutter/Documents/go/pdfcpu/cmd/pdfcpu/process.go:1885
main.commandMap.process
	/Users/horstrutter/Documents/go/pdfcpu/cmd/pdfcpu/cmd.go:143
main.commandMap.process
	/Users/horstrutter/Documents/go/pdfcpu/cmd/pdfcpu/cmd.go:152
main.main
	/Users/horstrutter/Documents/go/pdfcpu/cmd/pdfcpu/main.go:56
runtime.main
	/usr/local/go/src/runtime/proc.go:271
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1695

Other Information

systeminfo

OS Name:                   Microsoft Windows 10 Family
OS Version:                10.0.19045 N/A Build 19045
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Standalone Workstation
OS Build Type:             Multiprocessor Free
System Type:               x64-based PC

pdfcpu version

I am using the latest binary version: pdfcpu_0.7.0_Windows_x86_64.zip

pdfcpu: v0.7.0 dev
commit: dfaa588 (2024-03-05T01:16:46Z)
base  : go1.22.0

This is fixed with the latest commit!