-
Notifications
You must be signed in to change notification settings - Fork 115
Closed
Description
So I tried the following:
let document = pdfium.load_pdf_from_file(&args.file, None)?;
for (page_n, page) in document.pages().iter().enumerate() {
for (object_n, object) in page.objects().iter().enumerate() {
match &object {
PdfPageObject::Text(_) => println!("Got Text object"),
PdfPageObject::Path(_) => println!("Got Path object"),
PdfPageObject::Image(image_obj) => {
println!("Got Image object");
let image = image_obj.get_processed_image(&document)?;
image.save(format!("{page_n:0>3}_{object_n:0>3}.jpeg"))?;
}
PdfPageObject::Shading(_) => println!("Got Shading object"),
PdfPageObject::FormFragment(_) => println!("Got FormFragment object"),
PdfPageObject::Unsupported(_) => println!("Got Unsupported object"),
}
}
}This worked on the first image of a PDF I tried it on, after which I got an error Error: Pdfium(PdfiumLibraryInternalError(Unknown)). But the important point is that the image that did manage to get extracted had the colours all wrong - a mostly red image turned blue. I'm guessing this is due to #9 and that this doesn't use the set_reverse_byte_order flag?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels