-
-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ExtractImagesRaw not working since v0.3.12 #353
Comments
Please provide one small file that reproduces your symptoms so I can provide a fix. |
Looks like package main
import (
"fmt"
"os"
pdfapi "github.com/pdfcpu/pdfcpu/pkg/api"
"github.com/pdfcpu/pdfcpu/pkg/pdfcpu"
)
func readPDF(file string) (err error) {
f, err := os.Open(file)
if err != nil {
return err
}
defer f.Close()
fmt.Printf("PDF: Opening %s\n", f)
err = pdfapi.ExtractImages(f, nil, PrintImg, nil)
if err != nil {
fmt.Printf("PDF: %s\n", err)
return
}
return
}
func PrintImg(img pdfcpu.Image, singleImgPerPage bool, maxPageDigits int) error {
fmt.Printf("s:%s, d:%d, %#v\n", singleImgPerPage, maxPageDigits, img)
return nil
}
func main() {
fmt.Printf("ARGS: %#v\n", os.Args)
err := readPDF(os.Args[1])
if err != nil {
fmt.Printf("Error: %s\n", err)
panic(err)
}
} And it does work until:
|
Sent by mail |
Yes, there was some refactoring going on in that area in order ro make the reader containing image data optional for listing images where this is not needed. Thanks for reporting this. |
👍 This is fixed with the latest commit. I encourage everybody to go get the latest commit. |
I use pdfcpu as a library for a pet project to convert PDF files to comic books. (See below for the relevant code).
If I use a previous version (
go get github.com/pdfcpu/pdfcpu@v0.3.12-0.20210416123645-ac9adc6099fe
) my snippet works correctly.However with last release (
go get github.com/pdfcpu/pdfcpu
) (since v0.3.12)ExtractImagesRaw
stopped working with 2 symptoms:ExtractImagesRaw
).Seems to be related to either #329 or #323 (not sure).
I can provide by email some files having this issue.
Code I use:
The text was updated successfully, but these errors were encountered: