just like https://www.howtogeek.com/164668/how-to-electronically-sign-documents-without-printing-and-scanning-them/ especially adobe acrobat ?
i try to implement it, but no luck. still set image to static (specific coordinate). by allowing drop `PdfViewer1.AllowDrop = True`
- Code: Select all
Private Sub PdfViewer1_DragDrop(sender As Object, e As DragEventArgs) Handles PdfViewer1.DragDrop
Dim picbox As PdfViewer = CType(sender, PdfViewer)
Dim files As String() = CType(e.Data.GetData(DataFormats.FileDrop), String())
Dim fil As String = files(0).ToString
Dim pdfdoc As New PdfDocument
pdfdoc.LoadFromFile("c:\cust.pdf")
Dim pdfpage As PdfPageBase = pdfdoc.Pages(0)
If files.Length <> 0 Then
Try
Dim pdfimg As PdfImage = PdfImage.FromFile(fil)
pdfpage.Canvas.DrawImage(pdfimg, 562, 50, 40, 33)
pdfdoc.SaveToFile("C:\Users\xxx\Desktop\asd.pdf")
Catch ex As Exception
MessageBox.Show("Problem opening file ")
End Try
MsgBox("a")
End If
End Sub
Private Sub PdfViewer1_DragEnter(sender As Object, e As DragEventArgs) Handles PdfViewer1.DragEnter
If e.Data.GetDataPresent(DataFormats.FileDrop) Then
e.Effect = DragDropEffects.Copy
Else
e.Effect = DragDropEffects.None
End If
End Sub