Option Strict On Imports System.IO Imports Windows.Data.Pdf Public Class Form1 Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click '[NuGet パッケージ マネージャー] ウィンドウで、 '[参照] タブを選択して、Microsoft.Windows.SDK.Contracts を検索します。 'Microsoft.Windows.SDK.Contracts パッケージが見つかったら、 '[NuGet パッケージ マネージャー] ウィンドウの右側のペインで、 'ターゲットにする Windows 10 のバージョンに基づいて、 'インストールするパッケージのバージョンを選択します。 'https://qiita.com/kenichiuda/items/6617c25da6580eef85d1 'https://atmarkit.itmedia.co.jp/fdotnet/dotnettips/698scrollpic/scrollpic.html 'https://learn.microsoft.com/ja-jp/windows/win32/wic/-wic-guids-clsids Const WICPngEncoder As String = "27949969-876a-41d7-9447-568f6a35a4dc" Dim pdf As String = "C:\ほげほげ\サンプル.pdf" Using pdfFile As New FileStream(pdf, FileMode.Open, FileAccess.Read), pdfStream = pdfFile.AsRandomAccessStream() Dim pdfDoc = Await PdfDocument.LoadFromStreamAsync(pdfStream) Dim opt As New PdfPageRenderOptions() With {.BitmapEncoderId = Guid.Parse(WICPngEncoder)} ' For p = 0UI To pdfDoc.PageCount - 1UI Using page = pdfDoc.GetPage(0), pageMemory = New MemoryStream(), pngStream = pageMemory.AsRandomAccessStream() Await page.RenderToStreamAsync(pngStream, opt) Await pngStream.FlushAsync() Using imgStream = pngStream.AsStreamForRead(), pageImage = Image.FromStream(imgStream) PictureBox1.Image = Nothing PictureBox1.Image = System.Drawing.Image.FromStream(imgStream) End Using End Using ' Next End Using End Sub End Class