forked from buzzert/smartbar
Adds pdfbook command
This commit is contained in:
@@ -89,15 +89,18 @@ func main() {
|
|||||||
// Load order
|
// Load order
|
||||||
data, err := os.ReadFile(orderPath)
|
data, err := os.ReadFile(orderPath)
|
||||||
must(err)
|
must(err)
|
||||||
|
|
||||||
ordered, err := parseYAMLListOfStrings(string(data))
|
ordered, err := parseYAMLListOfStrings(string(data))
|
||||||
must(err)
|
must(err)
|
||||||
|
|
||||||
// Resolve Chrome
|
// Resolve Chrome
|
||||||
chromeExec, err := findChromeExec()
|
chromeExec, err := findChromeExec()
|
||||||
must(err)
|
must(err)
|
||||||
|
|
||||||
opts := append(chromedp.DefaultExecAllocatorOptions[:], chromedp.ExecPath(chromeExec), chromedp.Flag("headless", true), chromedp.Flag("disable-gpu", true), chromedp.Flag("hide-scrollbars", true))
|
opts := append(chromedp.DefaultExecAllocatorOptions[:], chromedp.ExecPath(chromeExec), chromedp.Flag("headless", true), chromedp.Flag("disable-gpu", true), chromedp.Flag("hide-scrollbars", true))
|
||||||
allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
|
allocCtx, cancel := chromedp.NewExecAllocator(context.Background(), opts...)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
ctx, cancel := chromedp.NewContext(allocCtx)
|
ctx, cancel := chromedp.NewContext(allocCtx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
@@ -146,6 +149,7 @@ func main() {
|
|||||||
|
|
||||||
// Merge PDFs into single output
|
// Merge PDFs into single output
|
||||||
must(os.MkdirAll(filepath.Dir(outPDF), 0o755))
|
must(os.MkdirAll(filepath.Dir(outPDF), 0o755))
|
||||||
|
|
||||||
// pdfcpu expects []string in order and writes outPDF
|
// pdfcpu expects []string in order and writes outPDF
|
||||||
must(pdfapi.MergeCreateFile(partPDFs, outPDF, false, nil))
|
must(pdfapi.MergeCreateFile(partPDFs, outPDF, false, nil))
|
||||||
fmt.Printf("Wrote %s (%d pages)\n", outPDF, len(partPDFs))
|
fmt.Printf("Wrote %s (%d pages)\n", outPDF, len(partPDFs))
|
||||||
|
|||||||
@@ -3,10 +3,10 @@
|
|||||||
- cover.html
|
- cover.html
|
||||||
- hack-the-planet.html
|
- hack-the-planet.html
|
||||||
- wtf.html
|
- wtf.html
|
||||||
|
- drivingmissmuni.html
|
||||||
|
- pearlstreetcafe.html
|
||||||
- gtkapplang-1.html
|
- gtkapplang-1.html
|
||||||
- gtkapplang-2.html
|
- gtkapplang-2.html
|
||||||
- gtkapplang-3.html
|
- gtkapplang-3.html
|
||||||
- gtkapplang-4.html
|
- gtkapplang-4.html
|
||||||
- drivingmissmuni.html
|
|
||||||
- pearlstreetcafe.html
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user