diff --git a/internal/pdf/generator.go b/internal/pdf/generator.go index 09e7200..e46eb90 100644 --- a/internal/pdf/generator.go +++ b/internal/pdf/generator.go @@ -34,10 +34,8 @@ func (g *Generator) GenerateFromURL(ctx context.Context, url string) ([]byte, er // Create chromedp options for headless mode (especially for CI environments) opts := append(chromedp.DefaultExecAllocatorOptions[:], - chromedp.Flag("headless", true), - chromedp.Flag("disable-gpu", true), - chromedp.Flag("no-sandbox", true), - chromedp.Flag("disable-dev-shm-usage", true), + chromedp.NoSandbox, + chromedp.DisableGPU, ) // Create exec allocator with custom options @@ -114,8 +112,18 @@ func (g *Generator) GenerateFromURLWithOptions(ctx context.Context, url string, ctx, cancel := context.WithTimeout(ctx, g.timeout) defer cancel() + // Create chromedp options for headless mode (especially for CI environments) + opts := append(chromedp.DefaultExecAllocatorOptions[:], + chromedp.NoSandbox, + chromedp.DisableGPU, + ) + + // Create exec allocator with custom options + execCtx, execCancel := chromedp.NewExecAllocator(ctx, opts...) + defer execCancel() + // Create chromedp context - allocCtx, allocCancel := chromedp.NewContext(ctx) + allocCtx, allocCancel := chromedp.NewContext(execCtx) defer allocCancel() // Buffer to store PDF