REST API GET response to PDF file open

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
FellowYellow
Posts: 1
Joined: 05 May 2022, 07:17

REST API GET response to PDF file open

Post by FellowYellow » 05 May 2022, 08:26

Hello!

I have figured out from searching around how to make a REST GET call to retrieve a PDF. I get back a success response and the .responseText looks like it has got all the good stuff inside it.

Code: Select all

GetFile:
	oWhr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
	oWhr.Open("GET", "https://my URL to get file", false)
	oWhr.SetRequestHeader("Authorization", "Basic ABC123")
	oWhr.Send()
	TheResponse := % oWhr.responseText
Now I just want to somehow parse this response to a PDF and open the PDF.
Default application is fine (Adobe), if I have to specify path to Adobe.exe that is also fine, but I'm not sure how to go about doing so.
Would prefer not to save the file and have the user open, want it to be automatic as GetFile is called from a button and the next thing the user should see is the PDF open in Adobe, no "save as" prompts or anything.
Hopefully someone can point me in the right direction!

Return to “Ask for Help (v1)”