func (pdfg *PDFGenerator) Buffer() *bytes.Buffer {
	return &pdfg.outbuf
}
Buffer returns the embedded output buffer used if OutputFile is empty
package wkhtmltopdf
import (
	"bytes"
	"context"
	"errors"
	"fmt"
	"io"
	"io/ioutil"
	"os"
	"os/exec"
	"path/filepath"
	"strings"
	"sync"
)
type stringStore struct {
	val string
	sync.Mutex
}
func (ss *stringStore) Get() string {
	ss.Lock()
	defer ss.Unlock()
	return ss.val
}
func (ss *stringStore) Set(s string) {
	ss.Lock()
	ss.val = s
	ss.Unlock()
}
var binPath stringStore
func SetPath(path string) {
	binPath.Set(path)
}
func GetPath() string {
	return binPath.Get()
}
type Page struct {
	Input string
	PageOptions
}
func (p *Page) InputFile() string {
	return p.Input
}
func (p *Page) Args() []string {
	return p.PageOptions.Args()
}
func (p *Page) Reader() io.Reader {
	return nil
}
func NewPage(input string) *Page {
	return &Page{
		Input:       input,
		PageOptions: NewPageOptions(),
	}
}
type PageReader struct {
	Input io.Reader
	PageOptions
}
func (pr *PageReader) InputFile() string {
	return "-"
}
func (pr *PageReader) Args() []string {
	return pr.PageOptions.Args()
}
func (pr *PageReader) Reader() io.Reader {
	return pr.Input
}
func NewPageReader(input io.Reader) *PageReader {
	return &PageReader{
		Input:       input,
		PageOptions: NewPageOptions(),
	}
}
type PageProvider interface {
	Args() []string
	InputFile() string
	Reader() io.Reader
}
type PageOptions struct {
	pageOptions
	headerAndFooterOptions
}
func (po *PageOptions) Args() []string {
	return append(append([]string{}, po.pageOptions.Args()...), po.headerAndFooterOptions.Args()...)
}
func NewPageOptions() PageOptions {
	return PageOptions{
		pageOptions:            newPageOptions(),
		headerAndFooterOptions: newHeaderAndFooterOptions(),
	}
}
type cover struct {
	Input string
	pageOptions
}
type toc struct {
	Include bool
	allTocOptions
}
type allTocOptions struct {
	pageOptions
	tocOptions
	headerAndFooterOptions
}
type PDFGenerator struct {
	globalOptions
	outlineOptions
	Cover      cover
	TOC        toc
	OutputFile string  
	binPath   string
	outbuf    bytes.Buffer
	outWriter io.Writer
	stdErr    io.Writer
	pages     []PageProvider
}
func (pdfg *PDFGenerator) Args() []string {
	args := append([]string{}, pdfg.globalOptions.Args()...)
	args = append(args, pdfg.outlineOptions.Args()...)
	if pdfg.Cover.Input != "" {
		args = append(args, "cover")
		args = append(args, pdfg.Cover.Input)
		args = append(args, pdfg.Cover.pageOptions.Args()...)
	}
	if pdfg.TOC.Include {
		args = append(args, "toc")
		args = append(args, pdfg.TOC.pageOptions.Args()...)
		args = append(args, pdfg.TOC.tocOptions.Args()...)
		args = append(args, pdfg.TOC.headerAndFooterOptions.Args()...)
	}
	for _, page := range pdfg.pages {
		args = append(args, "page")
		args = append(args, page.InputFile())
		args = append(args, page.Args()...)
	}
	if pdfg.OutputFile != "" {
		args = append(args, pdfg.OutputFile)
	} else {
		args = append(args, "-")
	}
	return args
}
func (pdfg *PDFGenerator) ArgString() string {
	return strings.Join(pdfg.Args(), " ")
}
func (pdfg *PDFGenerator) AddPage(p PageProvider) {
	pdfg.pages = append(pdfg.pages, p)
}
func (pdfg *PDFGenerator) SetPages(p []PageProvider) {
	pdfg.pages = p
}
func (pdfg *PDFGenerator) ResetPages() {
	pdfg.pages = []PageProvider{}
}