Rasterizer 2017

IncludeAnnotations

# Copyright (c) 2019 ActivePDF, Inc.
# ActivePDF Rasterizer 2017
# Example generated 09/16/19 

# Get current path
$invocation = (Get-Variable MyInvocation).Value
$strPath = (Split-Path $invocation.MyCommand.Path) + "\"

# Instantiate Object
$oRAS = New-Object -ComObject APRasterizer.Object

# Open PDF
$oRAS.OpenFile($strPath + "doc.pdf")

# Get page count of open file
$pageCount = $oRAS.NumPages()

for ($currentPage = 1; $currentPage -lt $pageCount; $currentPage++)
{
  # Image Format
  # 1 = RGB
  # 2 = JPEG
  # 3 = TIFF
  # 4 = PNG
  # 5 = BMP
  $oRAS.ImageFormat = 2
  
  # Output Type
  # 1 = Stream
  # 2 = File
  $oRAS.OutputFormat = 2
  
  # Other settings
  $oRAS.OutputFileName = $strPath + "doc" + $currentPage + ".jpg"
  $oRAS.JPEGQuality = 72
  $oRAS.IncludeAnnotations = $True
  
  # Render the current page
  $oRAS.RenderPage($currentPage)
}

# Finished rendering pages, close file
$oRAS.CloseFile()

# Release Object
$oRAS = $null

# Process Complete
Write-Host "Done!"

Copyright © 2019 ActivePDF, Inc