Html2PDFWebCapture.java 3.25 KB
/*
 * Decompiled with CFR 0_118.
 * 
 * Could not load the following classes:
 *  com.adobe.aemfd.docmanager.Document
 *  com.adobe.pdfg.exception.ConversionException
 *  com.adobe.pdfg.exception.FileFormatNotSupportedException
 *  com.adobe.pdfg.exception.InvalidParameterException
 *  com.adobe.pdfg.logging.PDFGLogger
 */
package com.adobe.pdfg.impl;

import com.adobe.aemfd.docmanager.Document;
import com.adobe.pdfg.exception.ConversionException;
import com.adobe.pdfg.exception.FileFormatNotSupportedException;
import com.adobe.pdfg.exception.InvalidParameterException;
import com.adobe.pdfg.impl.GeneratePDFServiceImpl;
import com.adobe.pdfg.impl.GeneratePDFUtil;
import com.adobe.pdfg.impl.Html2PDFConvertorHelper;
import com.adobe.pdfg.logging.PDFGLogger;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Map;

public class Html2PDFWebCapture
implements Html2PDFConvertorHelper.IHtml2PDFConvertor {
    protected PDFGLogger pdfgLogger = PDFGLogger.getPDFGLogger(Html2PDFConvertorHelper.class);

    /*
     * WARNING - Removed try catching itself - possible behaviour change.
     * Enabled aggressive block sorting
     * Enabled unnecessary exception pruning
     * Enabled aggressive exception aggregation
     */
    public Map createPDF(GeneratePDFServiceImpl coreSvcImpl, String inputUrl, String fileTypeSettingsName, String securitySettingsName, Document settingsDoc, Document xmpDoc, String configString, File pdfgTmpDir, int spideringLevel, boolean isURL) throws ConversionException, FileFormatNotSupportedException, InvalidParameterException, Exception {
        String html = "<html><META HTTP-EQUIV=\"refresh\" content=\"2;url=" + inputUrl + "\"></html>";
        File tempHtmlFile = new File(pdfgTmpDir, "WebCapture.html");
        FileWriter fileWriter = null;
        try {
            try {
                fileWriter = new FileWriter(tempHtmlFile);
                fileWriter.write(html);
                fileWriter.flush();
            }
            catch (IOException e) {
                this.pdfgLogger.debug(e.getMessage());
                this.pdfgLogger.trace(e.getMessage(), null, (Throwable)e);
                Object var16_15 = null;
                if (fileWriter == null) return GeneratePDFUtil.getNative2PDFCaller().createPDF(coreSvcImpl, new Document(tempHtmlFile, false), inputUrl, true, null, settingsDoc, configString, xmpDoc, false);
                fileWriter.close();
                return GeneratePDFUtil.getNative2PDFCaller().createPDF(coreSvcImpl, new Document(tempHtmlFile, false), inputUrl, true, null, settingsDoc, configString, xmpDoc, false);
            }
            Object var16_14 = null;
            if (fileWriter == null) return GeneratePDFUtil.getNative2PDFCaller().createPDF(coreSvcImpl, new Document(tempHtmlFile, false), inputUrl, true, null, settingsDoc, configString, xmpDoc, false);
            fileWriter.close();
            return GeneratePDFUtil.getNative2PDFCaller().createPDF(coreSvcImpl, new Document(tempHtmlFile, false), inputUrl, true, null, settingsDoc, configString, xmpDoc, false);
        }
        catch (Throwable var15_18) {
            Object var16_16 = null;
            if (fileWriter == null) throw var15_18;
            fileWriter.close();
            throw var15_18;
        }
    }
}