Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Error submit process, can not download application/octet-stream.

New Here ,
Sep 07, 2017 Sep 07, 2017

Hi... I am a LaTeX user. I don't know HTML, JavaScript... My purpose, is to download a file, from a PDF file I created from an internet site. Here is the HTML example. Good working.

<!DOCTYPE html>

<html>

  <head>

    <meta charset="utf-8">

    <title>Post method example</title>

    <style>

      form {

        width: 420px;

      }

      div {

        margin-bottom: 20px;

      }

      label {

        display: inline-block;

        width: 240px;

        text-align: right;

        padding-right: 10px;

      }

      button, input {

        float: right;

      }

    </style>

  </head>

  <body>

    <form action="https://edu.casio.com/education/activity/download.php" method="post">

      <div>

        <label for="say">FILE NO:146</label>

        <input name="dl_FILE_NO" value="146">

      </div>

       <div>

        <label for="to">FILE NAME:fx991esplus.pdf</label>

        <input name="dl_FILE_NAME" value="fx991esplus.pdf">

      </div>

      <div>

        <label for="to">FILE CD:1</label>

        <input name="dl_FILE_CD" value="1">

      </div>

      <div>

        <button>Submit</button>

      </div>

    </form>

  </body>

</html>

Here is the LaTeX example.

\documentclass{article}

\usepackage[T1]{fontenc}

\usepackage[utf8]{inputenc}

\usepackage{lmodern}

\usepackage{hyperref}

\usepackage[pdftex]{insdljs}

\usepackage[pdftex]{eforms}

\begin{document}

\begin{Form}[action={https://edu.casio.com/education/activity/download.php},encoding=html,method=post]

\TextField[name=dl\_FILE\_NO,value={146}]{NO:}

\TextField[name=dl\_FILE\_NAME,value={fx991esplus.pdf}]{NAME:}

\TextField[name=dl\_FILE\_CD,value={1}]{CD:}

\Submit{Send}

\end{Form}

\href{https://www.gimp.org/}{GNU Image Manipulation Program}

\end{document}

My PDF file...

Ekran Görüntüsü - 2017-09-07 11-46-41.png

The PDF file I generated with LaTeX code first gave the following error, click the Send Key,

Ekran Görüntüsü - 2017-09-07 11-21-30.png

Then the following window appeared when I wrote http instead of https, click the Send Key,

Ekran Görüntüsü - 2017-09-07 10-46-05.png

What should I do? How can I solve this problem? I'm waiting for your help. Maybe I could have opened it in the wrong discussion place. My system, Adobe Reader Version 9.5.5 04/26/2013 - Firefox 54.0 (64 BIT) - Ubuntu 16.10.

Related Site: https://edu.casio.com/education/activity​ Language Turkish > Second Choice

TOPICS
Create PDFs
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 07, 2017 Sep 07, 2017

The error is in something you don't share with us, the download.php script. It is setting the wrong content-type, it must be "application/pdf".

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 10, 2017 Sep 10, 2017

Hello friends. There is no problem when running HTML. But I believe the following line will be my solution.

Ekran Görüntüsü - 2017-09-10 23-00-18.png

Web Console > Log network access > POST > Headers > Response headers > Content-Type application/octet-stream; name="fx991esplus.pdf"

Now I created a PDF with the Master PDF Editor program. Below is the JavaScript code (Push Button>Mouse Up>Run a JavaScript).

var url = "http://edu.casio.com/education/activity/download.php";

var dl_FILE_NO = this.getField("dl_FILE_NO");

var dl_FILE_NAME = this.getField("dl_FILE_NAME");

var dl_FILE_CD = this.getField("dl_FILE_CD");

var reply = app.alert(dl_FILE_NO.value+ " "+ dl_FILE_NAME.value +" "+ dl_FILE_CD.value);

this.submitForm(url, false);

When I clicked the Push Button,

first dialog      Ekran Görüntüsü - 2017-09-10 22-23-11.png , second dialogEkran Görüntüsü - 2017-09-10 22-23-14.pngand

latest dialog   Ekran Görüntüsü - 2017-09-10 22-23-33.png but it gives an error here;

An error occurred during the submit process. Cannot process content of type application/octet-stream; application/octet-stream; name="fx991esplus.pdf"

As far as I can see, the returning data can not process the PDF file. I would like to change the Content-Type response data. How can I add the following lines to the above JavaScript code? Or how can I add a line of code similar to this?

...

If (response.ContentType = application/octet-stream; name="fx991esplus.pdf")

response.ContentType = application/pdf; name="fx991esplus.pdf";

...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 10, 2017 Sep 10, 2017
LATEST

You have not shared with us the important code: the download.php file. This is what has to be mended. There is nothing wrong with the PDF.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines