Экспорт HTML в слово с верхними и нижними колонтитулами и изображениями (в кодировке base64)

Мне нужно экспортировать содержимое html в файл word вместе с верхними и нижними колонтитулами, а также изображениями. Я использовал код googoose.js, который работает, но это не экспорт изображений, которые являются изображениями base64, и экспорт обычных изображений

<html>

<head>
<title> Word document </title>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.googoose.js"></script>

<style>
    #googoose-footer {
        margin-right: 1in;
        position: absolute;
        width: 100%;
        text-align: right; 
    }
    #googoose-header {
        width: 100%;
        text-align: center;
    }
</style>



<style>
#btnExport
{
        width: 60%;
    height: 30px;
    background: #5090a9;
    border: none;
    color: white;
    box-shadow: 0px 2px 2px 2px #ddd;
    border-radius: 5px;
    cursor:pointer;
}

#btnDiv
{

float: right;
    width: 10%;
    *border: 1px solid black;
    padding: 15px;
}

#cnt-dv
{
    padding:15px;
    text-align:justify;

}
#hello-canvas
{
display:none;
}

</style>

</head>
<body>

<div align="right" id="btnDiv">

<input type="button" name="btnExport" id="btnExport" value="getDoc">
</div>

<br>
<br>
<br>
<br>
<div class='googoose-wrapper'>
    <div class='googoose header'>
       -----Header-----
    </div>
<br>
<br>
its often a challenge to identify the right set of tools and technologies to execute a project of business interest as the factors influencing the decision are multiple and complex. STSI specializes in analyzing the client’s business use case, scenario, environment, target audience and budget to propose the right blend of technologies, tools, infrastructure and resources that may be required to address the client needs. We are committed to Empower Our Clients From Ideas to Applications with a methodical approach.
Softthink Solutions (STSI) is an emerging, innovative IT services partner who provides end-to-end project solutions and premium class services in Business Intelligence, Artificial Intelligence, Data Integration, Cybersecurity, Cloud Services and Application Development.
Located just outside Washington D.C., Softthink is uniquely positioned with a highly skilled team of professionals who come equipped with a wide array of skillsets to address your technical needs.
Regardless of the size of your business or the scope of your project, our technical team will work with you to create a solution that makes good business sense and return on investment. We offer a broad spectrum of proactive IT solutions which can be customised for your needs, and with our flexible solutions and Agile Development sensibilities, we will deliver the right end result, on time. We partner with our clients to identify, design and automate repeatable processes and workflows, offering accuracy and seamless operation, and we can respond quickly with service and solutions when unexpected crises occur, helping avert incidents that would otherwise disrupt your business workflow.
Service-oriented, world class service providers
Broad skillset and expertise backed by experience to address your expectations
Ability to customize solutions and applications tailored to your specific needs
Focus on continuous improvement of our resources, skills and processes.

<br>


<img src="123.png">

Located just outside Washington D.C., Softthink is uniquely positioned with a highly skilled team of professionals who come equipped with a wide array of skillsets to address your technical needs.
Regardless of the size of your business or the scope of your project, our technical team will work with you to create a solution that makes good business sense and return on investment. We offer a broad spectrum of proactive IT solutions which can be customised for your needs, and with our flexible solutions and Agile Development sensibilities, we will deliver the right end result, on time. We partner with our clients to identify, design and automate repeatable processes and workflows, offering accuracy and seamless operation, and we can respond quickly with service and solutions when unexpected crises occur, helping avert incidents that would otherwise disrupt your business workflow.
Service-oriented, world class service providers
Broad skillset and expertise backed by experience to address your expectations
Ability to customize solutions and applications tailored to your specific needs
Focus on continuous improvement of our resources, skills and processes.

<br>
<br>
 <canvas id='hello-canvas'></canvas>

    <div class='googoose footer'>
    -------Copy-Rights-Reserved@2018-------
        Page <span class='googoose currentpage'></span>
        of <span class='googoose totalpage'></span>
    </div>
</div>


</body>


</html>

<script type="text/javascript">


$(document).ready(function() {
  $("#btnExport").click(function(e) {   
    var canvas = document.getElementById("hello-canvas");
    var ctx = canvas.getContext("2d");
    function r(ctx, x, y, w, h, c) {
      ctx.beginPath();
      ctx.rect(x, y, w, h);
      ctx.strokeStyle = c;
      ctx.stroke();
    }
    r(ctx, 0, 0, 32, 32, "black");
    r(ctx, 4, 4, 16, 16, "red");
    r(ctx, 8, 8, 16, 16, "green");
    r(ctx, 12, 12, 16, 16, "blue"); 


    var o = {
        download: 0,
        filename: 'test.doc'
    };
    $(document).googoose(o);
    });
});


</script>

работает нормально, но не экспортирует изображения, когда IMG SRC, как

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAMAAABrrFhUAAAACXBIWXMAAAsTAAALEwEAmpwYAAAD... ">

И я пробовал FileSaver.js и wordexport.js, но они не позволяют исправить верхний и нижний колонтитулы. Пожалуйста, дайте мне любое предложение, чтобы решить эту проблему

0 ответов

Другие вопросы по тегам