Copy link to clipboard
Copied
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...

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

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

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
Copy link to clipboard
Copied
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".
Copy link to clipboard
Copied
Hello friends. There is no problem when running HTML. But I believe the following line will be my solution.

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
, second dialog
and
latest dialog
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";
...
Copy link to clipboard
Copied
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.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more