Option Explicit On
Option Strict On
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
CreateThumbnail("test.pdf")
For Each img As Bitmap In pageImages
Dim f As New Form With {.BackgroundImage = img}
f.Size = img.Size
f.Show()
Next
End Sub
'PDFからサムネイル画像を作成する
Private Sub CreateThumbnail(inputFileName As String)
Dim format As Integer = gsConstants.DISPLAY_COLORS_RGB Or
gsConstants.DISPLAY_DEPTH_8 Or
gsConstants.DISPLAY_LITTLEENDIAN
Dim args As New List(Of String)({
Application.ProductName,
"-dSAFER",
"-dBATCH",
"-dNOPAUSE",
"-sDEVICE=display",
"-dDisplayFormat=" & format.ToString,
"-dTextAlphaBits=4",
"-dGraphicsAlphaBits=4",
"-r48",
inputFileName})
pageImages.Clear()
CallGhostScript(args.ToArray)
End Sub
End Class