Mailversand, etc.
This commit is contained in:
@@ -1,27 +1,22 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.ComponentModel
|
||||
Imports System.Data
|
||||
Imports System.Drawing
|
||||
Imports System.Text
|
||||
Imports System.Windows.Forms
|
||||
Imports System.Drawing
|
||||
Imports System.IO
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
Imports System.Text
|
||||
Imports System.Threading
|
||||
'Imports Dynamsoft.Barcode
|
||||
Imports Dynamsoft.TWAIN
|
||||
Imports System.Windows.Forms
|
||||
Imports Dynamsoft.Core
|
||||
Imports Dynamsoft.Core.Annotation
|
||||
Imports Dynamsoft.Core.Enums
|
||||
'Imports Dynamsoft.UVC
|
||||
'Imports Dynamsoft.OCR
|
||||
Imports Dynamsoft.PDF
|
||||
Imports Dynamsoft.Core.Annotation
|
||||
Imports Dynamsoft.PDF.Enums
|
||||
'Imports Dynamsoft.Barcode
|
||||
Imports Dynamsoft.TWAIN
|
||||
'Imports Dynamsoft.UVC.Common
|
||||
Imports Dynamsoft.TWAIN.Interface
|
||||
Imports Dynamsoft.Core.Enums
|
||||
Imports System.IO
|
||||
Imports Dynamsoft.TWAIN.Enums
|
||||
Imports Dynamsoft.DotTwain
|
||||
Imports ClosedXML.Excel
|
||||
Imports Dynamsoft.PDF.Enums
|
||||
Imports Spire.Pdf
|
||||
|
||||
|
||||
|
||||
'Aktuell3
|
||||
@@ -64,25 +59,6 @@ Public Class frmScan
|
||||
init()
|
||||
End Sub
|
||||
|
||||
|
||||
Public Enum TwainSupportedSizes As UShort
|
||||
TWSS_NONE = 0
|
||||
TWSS_A4 = 1
|
||||
TWSS_JISB5 = 2
|
||||
TWSS_USLETTER = 3
|
||||
TWSS_USLEGAL = 4
|
||||
TWSS_A5 = 5
|
||||
TWSS_ISOB4 = 6
|
||||
TWSS_ISOB6 = 7
|
||||
TWSS_USLEDGER = 9
|
||||
TWSS_USEXECUTIVE = 10
|
||||
TWSS_A3 = 11
|
||||
TWSS_B4 = 12
|
||||
TWSS_B6 = 13
|
||||
TWSS_BUSINESSCARD = 14
|
||||
End Enum
|
||||
|
||||
|
||||
Public Sub OnPostAllTransfers() Implements IAcquireCallback.OnPostAllTransfers
|
||||
Me.Invoke(New CrossThreadOperationControl(AddressOf CallMe))
|
||||
End Sub
|
||||
@@ -267,8 +243,8 @@ Public Class frmScan
|
||||
'startScanTimeout()
|
||||
startScan()
|
||||
|
||||
cboFormat.SelectedIndex = cboFormat.FindStringExact("A4")
|
||||
If cboFormat.SelectedIndex > 0 Then cbxAltFormat.Checked = True
|
||||
'cboFormat.SelectedIndex = cboFormat.FindStringExact("A4")
|
||||
'If cboFormat.SelectedIndex > 0 Then cbxAltFormat.Checked = True
|
||||
|
||||
|
||||
End Sub
|
||||
@@ -457,6 +433,18 @@ Public Class frmScan
|
||||
.ValueMember = "Value"
|
||||
End With
|
||||
|
||||
cboOrientation.Items.Clear()
|
||||
|
||||
Dim itemsOrient = [Enum].GetValues(GetType(PdfPageOrientation)).Cast(Of PdfPageOrientation)().Select(Function(e) New KeyValuePair(Of String, PdfPageOrientation)(e.ToString(), e)).ToList()
|
||||
|
||||
With cboOrientation
|
||||
.DataSource = itemsOrient
|
||||
.DisplayMember = "Key"
|
||||
.ValueMember = "Value"
|
||||
End With
|
||||
|
||||
|
||||
|
||||
|
||||
If hasTwainSource Then
|
||||
cboSource.Enabled = True
|
||||
@@ -497,9 +485,13 @@ Public Class frmScan
|
||||
Select Case ART
|
||||
Case "DirectScan"
|
||||
|
||||
If cboFormat.SelectedIndex >= 0 Then
|
||||
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
|
||||
If cbxAltFormat.Checked Then m_PDFCreator.PageSize = selectedPaper
|
||||
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
|
||||
Dim orient As PdfPageOrientation = CType(cboOrientation.SelectedValue, PdfPageOrientation)
|
||||
If cbxAltFormat.Checked Then
|
||||
m_PDFCreator.PageSize = selectedPaper
|
||||
If orient = PdfPageOrientation.Landscape Then
|
||||
saveAsLandscape()
|
||||
End If
|
||||
End If
|
||||
|
||||
Dim PDF_bytes As Byte() = m_PDFCreator.SaveAsBytes(TryCast(Me, ISave))
|
||||
@@ -596,10 +588,17 @@ Public Class frmScan
|
||||
If SaveFileDialog.ShowDialog() = DialogResult.OK Then
|
||||
' Multi page PDF
|
||||
If cboFormat.SelectedIndex >= 0 Then
|
||||
|
||||
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
|
||||
If cbxAltFormat.Checked Then m_PDFCreator.PageSize = selectedPaper
|
||||
End If
|
||||
m_PDFCreator.Save(TryCast(Me, ISave), SaveFileDialog.FileName)
|
||||
Dim orient As PdfPageOrientation = CType(cboOrientation.SelectedValue, PdfPageOrientation)
|
||||
If cbxAltFormat.Checked Then
|
||||
m_PDFCreator.PageSize = selectedPaper
|
||||
If orient = PdfPageOrientation.Landscape Then
|
||||
saveAsLandscape()
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
m_PDFCreator.Save(TryCast(Me, ISave), SaveFileDialog.FileName)
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
@@ -775,9 +774,13 @@ Public Class frmScan
|
||||
Case "QuickScan"
|
||||
Do
|
||||
startScan()
|
||||
If cboFormat.SelectedIndex >= 0 Then
|
||||
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
|
||||
If cbxAltFormat.Checked Then m_PDFCreator.PageSize = selectedPaper
|
||||
Dim selectedPaper As EnumPageSize = CType(cboFormat.SelectedValue, EnumPageSize)
|
||||
Dim orient As PdfPageOrientation = CType(cboOrientation.SelectedValue, PdfPageOrientation)
|
||||
If cbxAltFormat.Checked Then
|
||||
m_PDFCreator.PageSize = selectedPaper
|
||||
If orient = PdfPageOrientation.Landscape Then
|
||||
saveAsLandscape()
|
||||
End If
|
||||
End If
|
||||
Dim PDF_bytes As Byte() = m_PDFCreator.SaveAsBytes(TryCast(Me, ISave))
|
||||
Me.fileName = addExtension(tbxSaveFileName.Text) ' DS.LAST_ID
|
||||
@@ -828,7 +831,44 @@ Public Class frmScan
|
||||
|
||||
Private Sub cbxAltFormat_CheckedChanged(sender As Object, e As EventArgs) Handles cbxAltFormat.CheckedChanged
|
||||
cboFormat.Enabled = cbxAltFormat.Checked
|
||||
cboOrientation.Enabled = cbxAltFormat.Checked
|
||||
End Sub
|
||||
|
||||
Private Sub saveAsLandscape()
|
||||
|
||||
Dim iImageWidth As Integer = m_ImageCore.ImageBuffer.GetBitmap(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer).Width
|
||||
Dim iImageHeight As Integer = m_ImageCore.ImageBuffer.GetBitmap(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer).Height
|
||||
'Dim tempListAnnotation As List(Of AnnotationData) = DirectCast(m_ImageCore.ImageBuffer.GetMetaData(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, EnumMetaDataType.enumAnnotation), List(Of AnnotationData))
|
||||
'For Each tempAnnotation As AnnotationData In tempListAnnotation
|
||||
' Dim x As Integer = iImageHeight - (tempAnnotation.Location.Y + tempAnnotation.Size.Height)
|
||||
' Dim y As Integer = tempAnnotation.Location.X
|
||||
' Dim iWidth As Integer = tempAnnotation.Size.Height
|
||||
' Dim iHeight As Integer = tempAnnotation.Size.Width
|
||||
' Select Case tempAnnotation.AnnotationType
|
||||
' 'case AnnotationType.enumLine:
|
||||
' Case Dynamsoft.Core.Enums.AnnotationType.enumEllipse, Dynamsoft.Core.Enums.AnnotationType.enumRectangle, Dynamsoft.Core.Enums.AnnotationType.enumText
|
||||
' tempAnnotation.StartPoint = New Point(x, y)
|
||||
' tempAnnotation.EndPoint = New Point((tempAnnotation.StartPoint.X + iWidth), (tempAnnotation.StartPoint.Y + iHeight))
|
||||
' Exit Select
|
||||
' Case Dynamsoft.Core.Enums.AnnotationType.enumLine
|
||||
' Dim startPoint As Point = tempAnnotation.StartPoint
|
||||
' x = iImageHeight - startPoint.Y
|
||||
' y = startPoint.X
|
||||
' tempAnnotation.StartPoint = New Point(x, y)
|
||||
' Dim endPoint As Point = tempAnnotation.EndPoint
|
||||
' x = iImageHeight - endPoint.Y
|
||||
' y = endPoint.X
|
||||
' tempAnnotation.EndPoint = New Point(x, y)
|
||||
' Exit Select
|
||||
' End Select
|
||||
'Next
|
||||
|
||||
If iImageHeight > iImageWidth Then
|
||||
m_ImageCore.ImageProcesser.Rotate(m_ImageCore.ImageBuffer.CurrentImageIndexInBuffer, 90, False, EnumInterpolationMethod.BestQuality)
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user