I can't download pdf in webview. Download the php page instead of the pdf

I have an application, which makes a simple integration through webview.

In this Webview, I need to enter a login and password. Navigation is normal.
But when I try to download a PDF file. It gives error.

It can even download, but instead of downloading the pdf file, it download is an html from the PHP page that generates the PDF.

It is the page of access denied, when trying to access the system without having logged in. But I’m already logged in, you understand? I browse normally between pages, only when I try to download the pdf that happens. I already tried everything that is within my reach of knowledge and I couldn’t solve it, I already read everything in the community about webview and downloads, but I couldn’t solve it. Below are my blocks.

Welcome. Where are your blocks for users to try to help you?

blocks_var

1 Like

Your Content-Type header, either text/html or application/pdf ?

Thank you for your help. Well, I’m not sure what the Content-Type is.

The application that is inside the Webview is a third party.

Through the computer’s browser, when I click on the link in question. It opens a pop up with a variable in the URL to generate the PDF. It’s a boleto.

In other words, the PDF is generated when you access the URL, you know?

So instead of downloading the boleto, what is downloading is the PHP page that generates the boleto, not the PDF.

I tried something with the clock, to try to wait to generate the PDF, but without success.

I never used webview.
I know how to generate boletos: either you use a library ( TCPDF ) to generate your own boleto (I do my reports this way) or you use an API like GerenciaNet or Juno.

For example, GerenciaNet does not need to be logged in to access the boleto. I’ve already done the test, when I have a URL for the boleto, which I don’t need is logged in. Then I download the ticket without any problem.

But when I need to be logged in to download the boleto, this problem happens.

Instead of downloading the PDF. The page that generates the PDF is downloaded.

With the same Kodular blocks Code ?

1 Like

Yes, with those same blocks.

The problem is when I have to be logged in.

I’m doing tests with a CRM. And in this CRM, only logged in I can generate the boleto.

In another CRM that is integrated with GerenciaNet, when I click on the link to download the PDF of the boleto, it works normal because in this integration with the GerenciaNet, you do not need to be logged in to access the Boleto URL.

In this scenario where the error occurs. It is as if the download component of kodular was accessing the system for the first time, but I am already logged in, if not, I would not be able to see the downlod button in the pdf payment slip.

I don’t know if I managed to be clear. I don’t speak English, I need the translator.