Skip to content

Downloading a resource (403 forbidden) #3

@corrspt

Description

@corrspt

Hi,

This isn't really an issue with the api2pdf java API, but, I think you guys might be able to help.

After successfully invoking the api and receiving a response I have the following:

Api2PdfResponse pdfResponse =
          a2pClient.headlessChromeFromHtml(baos.toString("UTF-8"), false, "wps.pdf", options);
      String pdfUrl = pdfResponse.getPdf();

I want to download the file in pdfUrl but I keep getting a 403 forbidden.
I've tried, URLDecoding the value (and not decoding) the URL. I've tried using apache.commons.FileUtils.copyInputStreamToFile(); and i've tried making my own download (using URLConnection) but I always get the 403 return code.

I've printout the pdfUrl and copy it to the address bar of my browser, it works perfectly. What header/cookie am I missing in the java side to be able to download the file?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions