Skip to Content
0
Former Member
Mar 02, 2009 at 08:26 AM

How to get Url to generated pdf?

168 Views

Hi Experts,

I have generated a PDF successfully and it is displayed in a new IE window. If I use HTTPWatch to track which traffic happens I can see, that an Url is send to the browser, which contains the Url to the pdf.

here is an example of the url:

<servername and port>/webdynpro/dispatcher/path/to/application/~wd_key~YC69GWiqO4s5kL53qmuaZA==~md/factsheet.pdf?sap-wd-download=4&sap-wd-cltwndid=c9e276f2070011de9e2a00145ec2715e&sap-wd-appwndid=c9e276f3070011de854a00145ec2715e&sap-wd-norefresh=X

With this url I can open a new window and display this pdf as long as I am in the same browser session.

This is the url I need to get, but I no idea how.

What I have found out so far:

If you bind the generated pdf to a binary context node (pdfsource) and you display this field as a textview you will see parts of this url

../../path/to/application/~wd_key~YC69GWiqO4s5kL53qmuaZA==~md/factsheet.pdf?sap-wd-download=4&sap-wd-cltwndid=c9e276f2070011de9e2a00145ec2715e&sap-wd-appwndid=c9e276f3070011de854a00145ec2715e&sap-wd-norefresh=X

but I can't get this url from the pdfsource object.

If I try pdfsource.toString() - I will get the referenced object

If I try new String(pdfsource) - I will get the pdf as data

There are no other methods available ...

Well there is a dirty way to get this data, but I won't use this in a productive application:

I can get the textview and get its value ... but this is really rough!

Thx in advance

Fabian