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:
Anthony Stirling
2025-09-04 12:21:29 +01:00
committed by GitHub
parent 7e276e8406
commit bf90f4b1da
5 changed files with 18 additions and 2 deletions

View File

@@ -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