mainrotor
asked on
I need help with .Tiff images being to large when saved from my WPF vb.Net
Hi Experts,
I have a WPF application with VB.Net code-behind.
When I save my document as a .tiff file to a directory, then later print the saved document it prints in normal 8 1/2 x 11 (i.e. Letter size).
When I fax that same saved document the one page is jumbo sized and takes up 6 pages.
What am I doing wrong?
Here is my code below:
I have a WPF application with VB.Net code-behind.
When I save my document as a .tiff file to a directory, then later print the saved document it prints in normal 8 1/2 x 11 (i.e. Letter size).
When I fax that same saved document the one page is jumbo sized and takes up 6 pages.
What am I doing wrong?
Here is my code below:
Private Sub cmdSave_Click(sender As Object, e As RoutedEventArgs) Handles cmdSave.Click
If ListToLoadX Is Nothing Then
MessageBox.Show("There are no image(s) to save.")
Exit Sub
End If
Try
Me.Cursor = Cursors.Wait
Dim SaveFileDialog = New SaveFileDialog
SaveFileDialog.Title = "Export Image As..."
SaveFileDialog.Filter = "Image Files (*.tif)|*.tif"
Dim ImageArr As New ArrayList
For Each XYA As ToLoadImages In ListToLoadX
ImageArr.Add(XYA.ImageX)
Next
Dim MasterBitMap As Bitmap = BitMapImage2BitMap(ImageArr.Item(0))
ExportSaved = ""
'Select the image encoder
Dim enc As Encoder = Encoder.SaveFlag
Dim info As ImageCodecInfo = Nothing
Dim ice As ImageCodecInfo
For Each ice In ImageCodecInfo.GetImageEncoders()
If ice.MimeType = "image/tiff" Then
info = ice
End If
Next ice
Dim ep As New EncoderParameters(1)
ep.Param(0) = New EncoderParameter(enc, CLng(EncoderValue.MultiFrame))
If SaveFileDialog.ShowDialog Then
Dim fileName As String = SaveFileDialog.FileName
MasterBitMap.Save(fileName, info, ep)
ep.Param(0) = New EncoderParameter(enc, CLng(EncoderValue.FrameDimensionPage))
'add all images from index 1 to n
Dim i As Integer
For i = 1 To (ImageArr.Count) - 1
MasterBitMap.SaveAdd(BitMapImage2BitMap(ImageArr.Item(i)), ep)
Next i
ep.Param(0) = New EncoderParameter(enc, CLng(EncoderValue.Flush))
MasterBitMap.SaveAdd(ep)
'Return True
MsgBox("File was saved successfully.")
ExportSaved = fileName 'True
End If
Me.Cursor = Cursors.Arrow
Me.Close()
Catch ee As System.Exception
ExportSaved = False
Me.Cursor = Cursors.Arrow
Throw New Exception(ee.Message & "Error in saving as multipage")
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Are you suggesting that I set the size of my image to 204x98 DPI or 204x196 DPI?