Skip to content

PrintToPDFCommand hangs forever when printing to PDF #37

@ststeiger

Description

@ststeiger

PrintToPDFCommand hangs forever when printing to PDF

public static double cm2inch(double centimeters)
{
    return centimeters * 0.393701;
}

PrintToPDFCommand printCommand = new PrintToPDFCommand()
{
    MarginTop = 0,
    MarginLeft = 0,
    MarginRight = 0,
    MarginBottom = 0,
    PrintBackground = true,
    Landscape = false,
    PaperWidth = cm2inch(21),
    PaperHeight = cm2inch(29.7)
};


System.Console.WriteLine("Printing PDF");
CommandResponse<PrintToPDFCommandResponse> pdf = await chromeSession.SendAsync(printCommand);
System.Console.WriteLine("PDF printed.");

byte[] pdfData = System.Convert.FromBase64String(pdf.Result.Data);
System.IO.File.WriteAllBytes("output.pdf", pdfData);
System.Console.WriteLine("PDF stored");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions