top of page

Powershell script to automate screen grabs of each page from a book

This night's post shows how you can use a PowerShell script to save each page of an online book as a PDF.


The process involves using an add-in for Chrome called Screenshot Capture.   See: https://chromewebstore.google.com/detail/screenshot-capture/giabbpobpebjfegnpcclkocepcgockkc

 

When this is installed, when you press ALT + S it will automatically save a .png file of the open page to a specified location.  Use these settings, with the option for ‘Capture Viewport’.

  


  


This is the script:

 

Add-Type -AssemblyName System.Windows.Forms

 

$pathToChrome = 'C:\Program Files\Google\Chrome\Application\chrome.exe'

$tempFolder = '--user-data-dir=c:\temp' # pick a temp folder for user data

$startmode = '--start-fullscreen' # '--kiosk' is another option

 

Start-Process -FilePath $pathToChrome -ArgumentList $tempFolder, $startmode, $startPage

 

Start-Sleep -Seconds 5 # Wait for the browser to load

 

for ($i = 0; $i -lt 10; $i++) {

 

    # Press Alt+S

    [System.Windows.Forms.SendKeys]::SendWait('%s')

    Start-Sleep -Milliseconds 5000 # Small delay between key presses

   

    # Press Page Down

    [System.Windows.Forms.SendKeys]::SendWait('{PGDN}')

    Start-Sleep -Milliseconds 5000 # Small delay between key presses

    }

 

 

 Be sure to confirm that the path on the second line is where you have Chrome installed on your PC.


Enter the url of the web page on the line beginning, ‘$startPage’

 

Indicate the number of pages you need to grab here [in this example it’s 10 pages]

 for ($i = 0; $i -lt 10; $i++) {

 

The PowerShell script in effect presses ‘ALT + S’ and then the page down key for you.

 

It’s possible that the script can get thrown off if a page takes a long time to load, so the last part of the script pauses for a set amount of milliseconds.   So 5000 equals 5 seconds.


In Chrome, be sure to enter full screen mode by pressing F11.

 

Just enter the script in the white pane at the top, and then press the play button.



After the script ends and the .png files are generated, you can easily convert them to a single PDF in Adobe Acrobat.


4 Comments


WKDU TRBD
WKDU TRBD
Jan 06

代发外链 提权重点击找我;

谷歌蜘蛛池 谷歌蜘蛛池;

Fortune Tiger…

Fortune Tiger…

谷歌权重提升/ 谷歌权重提升;

谷歌seo 谷歌seo;

谷歌霸屏 谷歌霸屏

蜘蛛池 蜘蛛池

谷歌快排 谷歌快排

Google外链 Google外链

谷歌留痕 谷歌留痕

Gái Gọi…

Gái Gọi…

Dịch Vụ…

谷歌霸屏 谷歌霸屏

负面删除 负面删除

币圈推广 币圈推广

Google权重提升 Google权重提升

Google外链 Google外链

google留痕 google留痕

Like

BFVY IRTO
BFVY IRTO
Dec 28, 2024

代发外链 提权重点击找我;

游戏推广 游戏推广;

Fortune Tiger Fortune Tiger;

Fortune Tiger Slots Fortune…

谷歌马甲包/ 谷歌马甲包;

谷歌霸屏 谷歌霸屏;

מכונות ETPU מכונות ETPU;

;ماكينات اي تي بي…

آلات إي بي بي…

ETPU maşınları ETPU maşınları;

ETPUマシン ETPUマシン;

ETPU 기계 ETPU 기계;

Like

WKDU TRBD
WKDU TRBD
Dec 28, 2024

代发外链 提权重点击找我;

谷歌蜘蛛池 谷歌蜘蛛池;

Fortune Tiger Fortune Tiger;

Fortune Tiger Slots Fortune…

谷歌权重提升/ 谷歌权重提升;

谷歌seo 谷歌seo;

מכונות ETPU מכונות ETPU;

Машини ETPU Машини ETPU

ETPU-Maschinen ETPU-Maschinen

EPS-машины EPS-машины

ЭПП-машины ЭПП-машины� بي يو

ETPU maşınları ETPU maşınları

ETPUマシン ETPUマシン

ETPU 기계 ETPU 기계

Like

AVXJ KAZD
AVXJ KAZD
Dec 26, 2024

代发外链 提权重点击找我;

google留痕 google留痕;

Fortune Tiger Fortune Tiger;

Fortune Tiger Fortune Tiger;

Fortune Tiger Slots Fortune…

站群/ 站群;

万事达U卡办理 万事达U卡办理;

VISA银联U卡办理 VISA银联U卡办理;

U卡办理 U卡办理;

万事达U卡办理 万事达U卡办理;

VISA银联U卡办理 VISA银联U卡办理;

U卡办理 U卡办理;

온라인 슬롯 온라인 슬롯;

온라인카지노 온라인카지노;

바카라사이트 바카라사이트;

EPS Machine EPS Machine;

EPS Machine EPS Machine;

EPS Machine EPS Machine;

EPS Machine EPS Machine;

Like
bottom of page