SharedPdfDocument.java 2.12 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.aemfd.docmanager.Document
 *  com.adobe.aemfd.docmanager.passivation.DocumentPassivationHandler
 *  com.adobe.internal.pdftoolkit.pdf.document.PDFDocument
 *  com.adobe.internal.pdftoolkit.pdf.document.PDFSaveOptions
 */
package com.adobe.aemfd.pdfdocmanager;

import com.adobe.aemfd.docmanager.Document;
import com.adobe.aemfd.docmanager.passivation.DocumentPassivationHandler;
import com.adobe.aemfd.pdfdocmanager.internal.passivation.PDFDocumentPassivationHandler;
import com.adobe.internal.pdftoolkit.pdf.document.PDFDocument;
import com.adobe.internal.pdftoolkit.pdf.document.PDFSaveOptions;
import java.io.IOException;

public class SharedPdfDocument
extends Document {
    private static final String PDF_DOC_ATTR_KEY = "pdfdocmanager.docattributes.PDFDocument";
    private static final String PDF_SAVE_OPT_ATTR_KEY = "pdfdocmanager.docattributes.PDFSaveOptions";

    SharedPdfDocument(PDFDocument pdfDoc, PDFSaveOptions options) {
        super((DocumentPassivationHandler)new PDFDocumentPassivationHandler(pdfDoc, options));
        this.setAttribute("pdfdocmanager.docattributes.PDFDocument", (Object)pdfDoc);
        this.setAttribute("pdfdocmanager.docattributes.PDFSaveOptions", (Object)options);
        this.setContentType("application/pdf");
    }

    public PDFDocument getPDFDocument() {
        this.checkDisposed();
        return (PDFDocument)this.getAttribute("pdfdocmanager.docattributes.PDFDocument");
    }

    public PDFSaveOptions getSaveOptions() {
        this.checkDisposed();
        return (PDFSaveOptions)this.getAttribute("pdfdocmanager.docattributes.PDFSaveOptions");
    }

    public long length() throws IOException {
        throw new UnsupportedOperationException("length() not supported on PDF-based documents!");
    }

    public String getContentType() throws IOException {
        return super.getContentType();
    }

    protected void postPassivate() throws IOException {
        this.removeAttribute("pdfdocmanager.docattributes.PDFDocument");
        this.removeAttribute("pdfdocmanager.docattributes.PDFSaveOptions");
    }
}