fixed colorspace array exception (#1925)
* fixed colorspace array exception * used lsf4j logger instead of prntln * removed unnecessary comment
This commit is contained in:
parent
0014560a96
commit
688e01d70d
1 changed files with 24 additions and 11 deletions
|
@ -90,22 +90,35 @@ public class ExtractImagesController {
|
||||||
// Iterate over each page
|
// Iterate over each page
|
||||||
for (int pgNum = 0; pgNum < document.getPages().getCount(); pgNum++) {
|
for (int pgNum = 0; pgNum < document.getPages().getCount(); pgNum++) {
|
||||||
PDPage page = document.getPage(pgNum);
|
PDPage page = document.getPage(pgNum);
|
||||||
int pageNum = document.getPages().indexOf(page) + 1;
|
|
||||||
// Submit a task for processing each page
|
|
||||||
Future<Void> future =
|
Future<Void> future =
|
||||||
executor.submit(
|
executor.submit(
|
||||||
() -> {
|
() -> {
|
||||||
extractImagesFromPage(
|
// Use the page number directly from the iterator, so no need to
|
||||||
page,
|
// calculate manually
|
||||||
format,
|
int pageNum = document.getPages().indexOf(page) + 1;
|
||||||
filename,
|
|
||||||
pageNum,
|
try {
|
||||||
processedImages,
|
// Call the image extraction method for each page
|
||||||
zos,
|
extractImagesFromPage(
|
||||||
allowDuplicates);
|
page,
|
||||||
return null;
|
format,
|
||||||
|
filename,
|
||||||
|
pageNum,
|
||||||
|
processedImages,
|
||||||
|
zos,
|
||||||
|
allowDuplicates);
|
||||||
|
} catch (IOException e) {
|
||||||
|
// Log the error and continue processing other pages
|
||||||
|
logger.error(
|
||||||
|
"Error extracting images from page {}: {}",
|
||||||
|
pageNum,
|
||||||
|
e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; // Callable requires a return type
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add the Future object to the list to track completion
|
||||||
futures.add(future);
|
futures.add(future);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue