0

I'm trying to download a .pdf file using web browser

The thing is the .pdf file does not have a direct link because the website creates the pdf file according to the user input and then replies with the pdf

Code included which fills all the data and clicks next when needed

After I fill the data with my code and click on download a new page on internet explorer opens and nothing happens instead of downloading the file

How can I download the pdf file through my program

Here is my code

Imports System.Net

Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    WebBrowser1.Navigate("https://www.misim.gov.il/gmIshurim/firstPage.aspx")

End Sub

Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
    WebBrowser1.Document.GetElementById("rbMeshalem").InvokeMember("click")
    WebBrowser1.Document.GetElementById("btnNext").InvokeMember("click")


End Sub

Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
    WebBrowser1.Document.GetElementById("txtMisTikMeshalem").SetAttribute("value", "510001001")
    WebBrowser1.Document.GetElementById("txtTik1").SetAttribute("value", "510000367")
    WebBrowser1.Document.GetElementById("btnNext").InvokeMember("click")

End Sub

Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
    WebBrowser1.Document.GetElementById("cbSelectAll").InvokeMember("click")
    WebBrowser1.Document.GetElementById("btnPrintIshur").InvokeMember("click")


End Sub
End Class
Soroush Falahati
  • 2,196
  • 1
  • 27
  • 38
  • Possible duplicate of [asp.net VB.net file download handler not work properly](https://stackoverflow.com/questions/43057026/asp-net-vb-net-file-download-handler-not-work-properly) – Dijkgraaf Jan 20 '19 at 21:41
  • Possible duplicate of https://stackoverflow.com/questions/15419632/download-a-file-through-the-webbrowser-control – Soroush Falahati Jan 20 '19 at 21:52

0 Answers0