Commit 8d49de77 authored by 张辰's avatar 张辰

test

parent 8e705824
...@@ -20,6 +20,35 @@ public class PagePdfGenUtils { ...@@ -20,6 +20,35 @@ public class PagePdfGenUtils {
try { try {
BrowserFetcher.downloadIfNotExist(null); BrowserFetcher.downloadIfNotExist(null);
try {
for (int i = 0;i < 5; i++) {
log.info("##### start genPdf");
genPdf("https://testtamper.tanpuyun.com/hangjiapc/#/billingPdf");
}
} catch (Exception e) {
log.error("error {}", e);
e.printStackTrace();
}
// ArrayList<String> argList = new ArrayList<>();
// LaunchOptions options = new LaunchOptionsBuilder()
// .withExecutablePath("/usr/bin/google-chrome")
// .withArgs(argList)
// .withHeadless(true)
// .build();
//
// argList.add("--no-sandbox");
// argList.add("--disable-setuid-sandbox");
// argList.add("--enable-logging=/data/logs/chrome22.log --v=1");
// browser = Puppeteer.launch(options);
isBrowserClosed = false;
} catch (Throwable t) {
log.error("error in init genPdf", t);
}
}
public static void genPdf(String url) throws Throwable {
ArrayList<String> argList = new ArrayList<>(); ArrayList<String> argList = new ArrayList<>();
LaunchOptions options = new LaunchOptionsBuilder() LaunchOptions options = new LaunchOptionsBuilder()
.withExecutablePath("/usr/bin/google-chrome") .withExecutablePath("/usr/bin/google-chrome")
...@@ -31,13 +60,8 @@ public class PagePdfGenUtils { ...@@ -31,13 +60,8 @@ public class PagePdfGenUtils {
argList.add("--disable-setuid-sandbox"); argList.add("--disable-setuid-sandbox");
argList.add("--enable-logging=/data/logs/chrome22.log --v=1"); argList.add("--enable-logging=/data/logs/chrome22.log --v=1");
browser = Puppeteer.launch(options); browser = Puppeteer.launch(options);
isBrowserClosed = false;
} catch (Throwable t) {
log.error("error in init genPdf", t);
}
}
public static void genPdf(String url) throws Throwable {
Page page = browser.newPage(); Page page = browser.newPage();
page.goTo(url); page.goTo(url);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment