Hi guys i seriously need someone else’s opinion on this,
At work we use a website that’s created in ASP to generate labels for on product, right now we have to fill in the information by hand and generate the label via the website, after the PDF is generated the website opens the PDF in the chrome-PDF viewer, i would like to automate this, so it saves the PDF’s automatically so the next them you need to generate that label, it can be directly printed..
I’ve tried the build-in webbrowser control to visit the website but it gives me a script error, ( the attachEvent property or method is not supported by this object ) so i cant even login with the build-in browser from visual studio, after that CefSharp came on my path, but after alot of struggles this also doesnt work, i’ve tried disabling CefSharp’s PDF viewer, and adding a DownloadHandler but after disabling the PDF viewer the website just opens a white screen.. I havent found a fix for that so maby there’s a easier and much more clearer way to automaticlly save a PDF from a website? Does someone has any idea?
Maybe not the best solution but you could do it with Selenium and just automate a chrome browser and call a save from the pdf page.
Alternately you probably need to snoop in their JS and see how the pdf is being served up and fetch it with your own js, usually when automating/scraping 3rd party stuff without an API you need to spend some time understanding how their site works so you can create the right http requests, maybe throwing wireshark on and seeing what’s happening might be worth a go?
C# devs
null reference exceptions