Add default to convert image to pdf api

This commit is contained in:
Reece Browne 2024-12-18 00:30:06 +00:00
parent e9f80d03ea
commit 12d86049f6

View File

@ -210,7 +210,13 @@ public class ConvertImgPDFController {
String fitOption = request.getFitOption();
String colorType = request.getColorType();
boolean autoRotate = request.isAutoRotate();
// Handle Null entries for formdata
if (colorType == null || colorType.isBlank()) {
colorType = "color";
}
if (fitOption == null || fitOption.isEmpty()) {
fitOption = "fitDocumentToImage";
}
// Convert the file to PDF and get the resulting bytes
byte[] bytes =
PdfUtils.imageToPdf(file, fitOption, autoRotate, colorType, pdfDocumentFactory);