Is it possible to convert a JPEG file to a PDF file in Java?
Tried the below:
// pdf converter
Document document = new Document(PageSize.A4, 20, 20, 20, 20);
PdfWriter.getInstance(document, new FileOutputStream("C:\\ss.jpeg"));
document.open();
Image image = Image.getInstance(getClass().getResource("C:\\file.pdf"));
document.add(image);
document.close();
Error: Cannot make a static reference to the non-static method
getClass()
from the type Object