Skip to content

Instantly share code, notes, and snippets.

@viniciusmelocodes
Last active February 1, 2019 15:32
Show Gist options
  • Save viniciusmelocodes/826d78090f5638b6962f8ccbcc9cba95 to your computer and use it in GitHub Desktop.
Save viniciusmelocodes/826d78090f5638b6962f8ccbcc9cba95 to your computer and use it in GitHub Desktop.
<html>
<head>
<title>Conversão PDF para TXT</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
</head>
<body>
<form action="#" method="post" enctype="multipart/form-data" name="conversionform" id="conversionform">
<br>
<div class="container">
<p>Arquivo Local: <input id="file" name="file" type="file" /></p>
<p>Para formato... <input value="txt" id="targetformat" name="targetformat" type="text" readonly /></p>
<p><input type="button" value="Converter PDF para TXT" onclick="convertpdfform()" /></p>
<!-- <p><span id="resulttext">Resultado da Conversão: </span></p> -->
<label>URL para Download: </label>
<a href="#" id="url_txt" target="_blank">
<span id="mensagemElement"></span>
</a>
</div>
</form>
<script src="https://www.aconvert.com/js/jquery.min.js"></script>
<script src="https://www.aconvert.com/js/jquery.form.js"></script>
<script type="text/javascript">
$(document).ready(function() {
});
function showResponse(responseText, statusText, xhr, $form) {
// resulttext.innerHTML=responseText;
var inicio = responseText.search("http");
var fim = responseText.search(".txt");
var url_download = responseText.substring(inicio, fim + 4);
mensagemElement.innerText = url_download;
var url_txt = document.getElementById('url_txt');
url_txt.setAttribute('href', url_download);
}
function showError(responseText, statusText, xhr, $form) {
}
function convertpdfform() {
options = {
success: showResponse,
error: showError,
url: "https://s2.aconvert.com/convert/api-win.php",
};
$('#conversionform').ajaxForm(options);
$('#conversionform').ajaxSubmit(options);
return false;
}
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment