I need to write some code that will allow a user to load a tiff document to the screen (.NET Forms) and view it page by page.
They might choose to rotate one of the pages.
How would I save the document after they rotate one of the pages?
This is my code so far:
Private Property MemoryPageStreamFactory As MemoryPageStreamFactory
Private Property tiffViewer As Viewer
Private Property jpgViewOptions As JpgViewOptions
Private Sub LoadPageIntoViewer(ByVal PageNumber As Integer)
Dim FileName As String = "FilePath/FileName.tiff"
tiffViewer = New Viewer(FileName)
MemoryPageStreamFactory = New MemoryPageStreamFactory()
jpgViewOptions = New JpgViewOptions(MemoryPageStreamFactory)
tiffViewer.View(jpgViewOptions, PageNumber)
MemoryPageStreamFactory.Stream.Position = 0
pictureBox.Image = System.Drawing.Image.FromStream(MemoryPageStreamFactory.Stream)
Dim tiffViewInfo As Results.ViewInfo = tiffViewer.GetViewInfo(ViewInfoOptions.ForJpgView)
txtPages.Text = tiffViewInfo.Pages.Count
End Sub
Private Sub btnRotate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRotate.Click
Dim selectedPage As Integer = txtPage.Text
jpgViewOptions.RotatePage(selectedPage, Rotation.On90Degree)
tiffViewer.View(jpgViewOptions, SelectedPage)
MemoryPageStreamFactory.Stream.Position = 0
pictureBox.Image = System.Drawing.Image.FromStream(MemoryPageStreamFactory.Stream)
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
' Save the tiff. If possible, it would be best if we can save the rotations now, instead of each time they click the Rotate button
End Sub