mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-17 13:52:14 +01:00
feat: add annotation option to PDF to image (#4365)
## Summary - add optional flag to include PDF annotations when converting to images - expose annotation option via API model and UI checkbox - add translation for annotation option ## Testing - `./gradlew spotlessApply` - `./gradlew build` ------ https://chatgpt.com/codex/tasks/task_b_68b7fa1d5a1c83288342244a0ec85e9d
This commit is contained in:
@@ -142,7 +142,8 @@ public class PdfUtils {
|
||||
ImageType colorType,
|
||||
boolean singleImage,
|
||||
int DPI,
|
||||
String filename)
|
||||
String filename,
|
||||
boolean includeAnnotations)
|
||||
throws IOException, Exception {
|
||||
|
||||
// Validate and limit DPI to prevent excessive memory usage
|
||||
@@ -163,6 +164,9 @@ public class PdfUtils {
|
||||
try (PDDocument document = pdfDocumentFactory.load(inputStream)) {
|
||||
PDFRenderer pdfRenderer = new PDFRenderer(document);
|
||||
pdfRenderer.setSubsamplingAllowed(true);
|
||||
if (!includeAnnotations) {
|
||||
pdfRenderer.setAnnotationsFilter(annotation -> false);
|
||||
}
|
||||
int pageCount = document.getNumberOfPages();
|
||||
|
||||
// Create a ByteArrayOutputStream to save the image(s) to
|
||||
|
||||
Reference in New Issue
Block a user