Commit 5f6d2e58 authored by 张辰's avatar 张辰

1

parent c998ca17
...@@ -35,17 +35,19 @@ public class PagePdfGenUtils { ...@@ -35,17 +35,19 @@ public class PagePdfGenUtils {
}); });
t.start(); t.start();
} }
// ArrayList<String> argList = new ArrayList<>();
// LaunchOptions options = new LaunchOptionsBuilder() ArrayList<String> argList = new ArrayList<>();
// .withExecutablePath("/usr/bin/google-chrome") LaunchOptions options = new LaunchOptionsBuilder()
// .withArgs(argList) .withExecutablePath("/usr/bin/google-chrome")
// .withHeadless(true) .withArgs(argList)
// .build(); .withHeadless(true)
// .build();
// argList.add("--no-sandbox");
// argList.add("--disable-setuid-sandbox"); argList.add("--no-sandbox");
// argList.add("--enable-logging=/data/logs/chrome22.log --v=1"); argList.add("--disable-setuid-sandbox");
// browser = Puppeteer.launch(options); argList.add("--enable-logging=/data/logs/chrome22.log --v=1");
browser = Puppeteer.launch(options);
isBrowserClosed = false; isBrowserClosed = false;
} catch (Throwable t) { } catch (Throwable t) {
log.error("error in init genPdf", t); log.error("error in init genPdf", t);
...@@ -54,18 +56,18 @@ public class PagePdfGenUtils { ...@@ -54,18 +56,18 @@ public class PagePdfGenUtils {
public static void genPdf(String url) throws Throwable { 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")
.withArgs(argList) // .withArgs(argList)
.withHeadless(true) // .withHeadless(true)
.build(); // .build();
//
argList.add("--no-sandbox"); // argList.add("--no-sandbox");
argList.add("--disable-setuid-sandbox"); // argList.add("--disable-setuid-sandbox");
argList.add("--enable-logging=/data/logs/chrome.log"); // argList.add("--enable-logging=/data/logs/chrome.log");
argList.add("--v=2"); // argList.add("--v=2");
browser = Puppeteer.launch(options); // browser = Puppeteer.launch(options);
Page page = browser.newPage(); Page page = browser.newPage();
......
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