<!DOCTYPE html><meta charset="utf-8">
<link rel="stylesheet" href="{{ url_for('static', filename='css/text_layer_builder.css') }}" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<!--
<script src="//mozilla.github.io/pdf.js/build/pdf.js"></script>
 -->
<!-- <script src="https://mozilla.github.io/pdf.js/build/pdf.js"></script>das funktioniert!!!!!
<script type="javascript" src="{{ url_for('static', filename='js/pdf.js') }}"></script>-->


<script type="javascript" src="https://unpkg.com/pdfjs-dist@latest/build/pdf.js" ></script>
https://cdnjs.cloudflare.com/ajax/libs/pdf.js/2.3.200/pdf.js
<script type="javascript" src="{{ url_for('static', filename='js/text_layer_builder.js') }}"></script>
<script type="javascript" src="{{ url_for('static', filename='js/ui_utils.js') }}"></script>
<body>
<canvas id="the-canvas"></canvas>
<script>

var url = "{{ url_for('send_file', filename=og_filename) }}";

var pdfjsLib = window['pdfjs-dist/build/pdf'];
pdfjsLib.disableWorker = true;

pdfjsLib.getDocument(url).then(function(pdf){
    var page_num = 1;
    pdf.getPage(page_num).then(function(page){
        var scale = 1.5;
        var viewport = page.getViewport(scale);
        var canvas = $('#the-canvas')[0];
        var context = canvas.getContext('2d');
        canvas.height = viewport.height;
        canvas.width = viewport.width;

        var canvasOffset = $(canvas).offset();
        var $textLayerDiv = $('#text-layer').css({
            height : viewport.height+'px',
            width : viewport.width+'px',
            top : canvasOffset.top,
            left : canvasOffset.left
        });

        page.render({
            canvasContext : context,
            viewport : viewport
        });

        page.getTextContent().then(function(textContent){
           console.log( textContent );
            var textLayer = new TextLayerBuilder({
                textLayerDiv : $textLayerDiv.get(0),
                pageIndex : page_num - 1,
                viewport : viewport
            });

            textLayer.setTextContent(textContent);
            textLayer.render();
        });
    });
});
</script>
</body>
</html>