diff --git a/print2pdf/print.go b/print2pdf/print.go index 7b867b4..577b5a1 100644 --- a/print2pdf/print.go +++ b/print2pdf/print.go @@ -155,6 +155,11 @@ func getPrintParams(data GetPDFParams) (page.PrintToPDFParams, error) { return params, nil } +// Check if the browser is still running. +func Running() bool { + return browserCtx != nil && browserCtx.Err() == nil +} + // Get a buffer of bytes representing a webpage in PDF format. func GetPDFBuffer(ctx context.Context, data GetPDFParams, res *[]byte) error { defer Elapsed("Total time to print PDF")()