Html2PDFConvertorHelper.java
3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/*
* 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.Html2PDFPhantomJS;
import com.adobe.pdfg.impl.Html2PDFWebCapture;
import com.adobe.pdfg.impl.Html2PDFWebkit;
import com.adobe.pdfg.logging.PDFGLogger;
import java.io.File;
import java.util.Map;
public class Html2PDFConvertorHelper {
public static final String WEB_CAPTURE_STR = "WEB_CAPTURE";
public static final String WEBKIT_STR = "WEBKIT";
public static final String PHANTOMJS_STR = "PHANTOMJS";
private static final PDFGLogger PDFG_LOGGER = PDFGLogger.getPDFGLogger(Html2PDFConvertorHelper.class);
private ROUTE myPrimaryRoute;
private ROUTE mySecondaryRoute;
public void setPrimaryRoute(String routeName) {
this.myPrimaryRoute = ROUTE.valueOf(routeName);
}
public void setSecondaryRoute(String routeName) {
if (routeName == null) {
this.mySecondaryRoute = null;
PDFG_LOGGER.info("Disabling fallback as secondary route is not set.");
return;
}
this.mySecondaryRoute = ROUTE.valueOf(routeName);
if (this.mySecondaryRoute.equals((Object)this.myPrimaryRoute)) {
this.mySecondaryRoute = null;
PDFG_LOGGER.info("Disabling fallback as secondary route is same as primary route.");
}
}
public ROUTE getPrimaryRoute() {
return this.myPrimaryRoute;
}
public ROUTE getSecondaryRoute() {
return this.mySecondaryRoute;
}
static {
for (ROUTE route : ROUTE.values()) {
ROUTE.initializeRouteProcessor(route);
}
}
/*
* This class specifies class file version 49.0 but uses Java 6 signatures. Assumed Java 6.
*/
public static enum ROUTE {
WEB_CAPTURE("WEB_CAPTURE"),
WEBKIT("WEBKIT"),
PHANTOMJS("PHANTOMJS");
private String myRouteName;
private IHtml2PDFConvertor myRouteProcessor;
private ROUTE(String name) {
this.myRouteName = name;
this.myRouteProcessor = null;
}
public static void initializeRouteProcessor(ROUTE route) {
switch (route) {
case WEB_CAPTURE: {
route.myRouteProcessor = new Html2PDFWebCapture();
break;
}
case WEBKIT: {
route.myRouteProcessor = new Html2PDFWebkit();
break;
}
case PHANTOMJS: {
route.myRouteProcessor = new Html2PDFPhantomJS();
}
}
}
public String getRouteName() {
return this.myRouteName;
}
public IHtml2PDFConvertor getRouteProcessor() {
return this.myRouteProcessor;
}
}
public static interface IHtml2PDFConvertor {
public Map createPDF(GeneratePDFServiceImpl var1, String var2, String var3, String var4, Document var5, Document var6, String var7, File var8, int var9, boolean var10) throws ConversionException, FileFormatNotSupportedException, InvalidParameterException, Exception;
}
}