// Path: src/main/java/technology/tabula/tabula_web/Utils.java
// public class Utils {
// 
//     private static final String DEFAULT_PASSWORD = "";
// 
//     public static PDDocument openPDF(String documentPath) throws IOException {
//         PDDocument document = PDDocument.load(new File(documentPath));
//         if (document.isEncrypted()) {
//             document.close();
//             document = PDDocument.load(new File(documentPath), DEFAULT_PASSWORD);
//             document.setAllSecurityToBeRemoved(true);
//         }
//         return document;
//     }
// }
// 
// Path: src/main/java/technology/tabula/tabula_web/workspace/WorkspaceDAO.java
// public interface WorkspaceDAO {
// 	
// 	Workspace getWorkspace() throws WorkspaceException;
// 
// 	void addDocument(WorkspaceDocument we, List<DocumentPage> pages) throws WorkspaceException;
// 
// 	void deleteDocument(String documentId) throws WorkspaceException;
// 
// 	WorkspaceDocument getDocumentMetadata(String documentId) throws WorkspaceException;
// 
// 	List<DocumentPage> getDocumentPages(String documentId) throws WorkspaceException;
// 
// 	String getDocumentPath(String documentId);
// 	
// 	String getDocumentDir(String documentId);
// 
// 	String getDataDir();
// 	
// 	void addFile(InputStream stream, String documentId, String filename) throws WorkspaceException;
// 
// }


import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import technology.tabula.tabula_web.Utils;
import technology.tabula.tabula_web.workspace.WorkspaceDAO;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.UUID;
package technology.tabula.tabula_web.background.job;




public class GeneratePageThumbnails extends Job {

    private final String filePath;
    private final String documentId;
    private final PDDocument pdfDocument;
    private WorkspaceDAO workspaceDAO;

    private static final int SIZE = 800;
    final static Logger logger = LoggerFactory.getLogger(GeneratePageThumbnails.class);

    public GeneratePageThumbnails(String filePath, String documentId, UUID batch, WorkspaceDAO workspaceDAO) throws Exception {
        super(batch);
        this.filePath = filePath;
        this.documentId = documentId;
        this.workspaceDAO = workspaceDAO;

// Path: src/main/java/technology/tabula/tabula_web/Utils.java
// public class Utils {
// 
//     private static final String DEFAULT_PASSWORD = "";
// 
//     public static PDDocument openPDF(String documentPath) throws IOException {
//         PDDocument document = PDDocument.load(new File(documentPath));
//         if (document.isEncrypted()) {
//             document.close();
//             document = PDDocument.load(new File(documentPath), DEFAULT_PASSWORD);
//             document.setAllSecurityToBeRemoved(true);
//         }
//         return document;
//     }
// }
// 
// Path: src/main/java/technology/tabula/tabula_web/workspace/WorkspaceDAO.java
// public interface WorkspaceDAO {
// 	
// 	Workspace getWorkspace() throws WorkspaceException;
// 
// 	void addDocument(WorkspaceDocument we, List<DocumentPage> pages) throws WorkspaceException;
// 
// 	void deleteDocument(String documentId) throws WorkspaceException;
// 
// 	WorkspaceDocument getDocumentMetadata(String documentId) throws WorkspaceException;
// 
// 	List<DocumentPage> getDocumentPages(String documentId) throws WorkspaceException;
// 
// 	String getDocumentPath(String documentId);
// 	
// 	String getDocumentDir(String documentId);
// 
// 	String getDataDir();
// 	
// 	void addFile(InputStream stream, String documentId, String filename) throws WorkspaceException;
// 
// }


// Path: src/main/java/technology/tabula/tabula_web/background/job/GeneratePageThumbnails.java
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.rendering.PDFRenderer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import technology.tabula.tabula_web.Utils;
import technology.tabula.tabula_web.workspace.WorkspaceDAO;
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.*;
import java.util.UUID;

package technology.tabula.tabula_web.background.job;




public class GeneratePageThumbnails extends Job {

    private final String filePath;
    private final String documentId;
    private final PDDocument pdfDocument;
    private WorkspaceDAO workspaceDAO;

    private static final int SIZE = 800;
    final static Logger logger = LoggerFactory.getLogger(GeneratePageThumbnails.class);

    public GeneratePageThumbnails(String filePath, String documentId, UUID batch, WorkspaceDAO workspaceDAO) throws Exception {
        super(batch);
        this.filePath = filePath;
        this.documentId = documentId;
        this.workspaceDAO = workspaceDAO;

        this.pdfDocument = Utils.openPDF(this.filePath);