I thought I replied here. I didn't notice that it gets queued to be approved or not...
Use a web_reg_save_param_ex before the web call and use Scope=Headers.
I don't have a site to test handy to get the exact LB & RB, but should be "Permanent-Redirect:" or something like that.
Run the script with full logging on and you will see the line in the headers of the page.
web_reg_save_param_ex(
"ParamName=pPDF_name",
"LB=filename=\"",
"RB=\"\r\nContent-Type: application/pdf",
"Notfound=Warning",
SEARCH_FILTERS,
"Scope=Headers",
LAST);