I try the 2 solutions with the same error.
Var pic As Picture
'pic = p.BestRepresentation(100, 100, 32.0)
pic = p.ImageAt(0)
If Picture.IsExportFormatSupported(Picture.Formats.JPEG) Then
Var tmp As FolderItem = SpecialFolder.Temporary.Child("FirstPage.jpg")
Try
pic.Save(tmp, Picture.Formats.JPEG)
MessageBox("PDF first page saved as JPEG in: " + tmp.NativePath)
Catch error As UnsupportedOperationException
MessageBox("Save failed: " + error.Message)
End Try
Else
MessageBox("JPEG export is not supported on this platform.")
End If
I made this test, and imageViewer show a valid image as expected.
Var p As Picture
p = Picture.Open(file)
ImageViewer1.Image = p.BestRepresentation(100, 100, 32.0)
I also made this test, and got ant OutOfBoundsException p.image.Count return 0 in the console…
System.DebugLog(p.ImageCount.ToString)
ImageViewer1.Image = p.ImageAt(0)