/// <summary>
        /// Main cmdlet logic.
        /// </summary>
        protected override void ProcessRecord()
        {
            if (Pdf)
            {
                var pdf = Scraper.CreatePdf();

                WriteObject(pdf);

                if (Path == null)
                {
                    return;
                }

                var buffer = new byte[pdf.Length];
                pdf.Read(buffer, 0, buffer.Length);
                File.WriteAllBytes(Path, buffer);

                return;
            }

            var img = Scraper.SnapshotBitmap();

            WriteObject(img);

            if (Path == null)
            {
                return;
            }

            img.Save(Path);
        }