Issue
I know that only real programmers can solve this problem.. I want to load a PDF file into a Text Box, I found working demo here
[view-source:http://checkpointcams.com/test/test.html
] .... when I download HTML + JS files, and I put all files in my server and when I remove <base href="
, and <select>
elements, it doesn't work in my project - domain.
Can someone modify demo HTML and .js files to make this HTML run on all domains /offline mode, without that <base href=
and <select>
elements? Btw I think this problem is related to a file called "script19.min.js" which needs to be modified.
All that I need is, this simple working Html file + [ js files], Text Box and Upload / Load button.
Solution
Solution
I'm unsure what your console errors are reporting, but I was able to get the pdf working on an expressjs server by placing test.html in the root of a static file server public
and each of those minified js files in a directory named js with public
.
<root_directory>/fire/public
├── js
| ├── jquery-3.1.1.min.js
| ├── pdf.min.js
| ├── pdf.worker.min.js
| ├── pdfparser2.min.js
| └── script19.min.js
└── test
└── test.html
I also made the src
s reference relative directories in the test.html
.
<!DOCTYPE html>
<html lang="en" style="">
<head>
<script type="text/javascript" src="/js/pdf.min.js"></script>
<base href="/test/">
</head>
<body>
<br>
<br>
<button type="button" class="btn btn-default btn-lg tts-btn" title="Upload text, pdf or ebook file">
<span class="glyphicon glyphicon-open-file btn-glyph" aria-hidden="true"></span>
<input type="file" id="files" name="files[]">
</button>
<br>
<br>
<div class="buttons_row">
<select class="btn btn-template-primary" id="select_language">
<option value=" UK English Male">UK English (default)</option>
</select>
<select class="btn btn-template-primary" id="select_speed">
<option value="0.9">Normal Speed</option>
</select>
</div>
<br>
<br>
<textarea id="text_box" rows="7" cols="50"></textarea>
<script src="/js/jquery-3.1.1.min.js"></script>
<script src="/js/pdf.worker.min.js"></script>
<script src="/js/pdfparser2.min.js"></script>
<script src="/js/script19.min.js"></script>
</body>
</html>
On my end, I did notice that the pdf.min.js
expects a served directory named js
so I suspect this code was built with webpack. I highly recommend diving into modern web tooling - node, npm, webpack, etc - as copy and pasting minified javascript gets hairy quickly.
Code
https://github.com/onescriptkid/stackoverflow60162806
Example
https://i.gyazo.com/64c3769f824a793cdb38d058c5e030a4.gif
Answered By - Try Again
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.