bscheibel 4 years ago
parent
commit
2bb5513efb

+ 0 - 95
app/static/css/text_layer_builder.css

@@ -1,95 +0,0 @@
-/* Copyright 2014 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-.textLayer {
-  position: absolute;
-  left: 0;
-  top: 0;
-  right: 0;
-  bottom: 0;
-  overflow: hidden;
-  opacity: 0.2;
-  line-height: 1.0;
-}
-
-.textLayer > span {
-  color: transparent;
-  position: absolute;
-  white-space: pre;
-  cursor: text;
-  transform-origin: 0% 0%;
-}
-
-.textLayer .highlight {
-  margin: -1px;
-  padding: 1px;
-
-  background-color: rgb(180, 0, 170);
-  border-radius: 4px;
-}
-
-.textLayer .highlight.begin {
-  border-radius: 4px 0px 0px 4px;
-}
-
-.textLayer .highlight.end {
-  border-radius: 0px 4px 4px 0px;
-}
-
-.textLayer .highlight.middle {
-  border-radius: 0px;
-}
-
-.textLayer .highlight.selected {
-  background-color: rgb(0, 100, 0);
-}
-
-.textLayer ::selection { background: rgb(0,0,255); }
-
-.textLayer .endOfContent {
-  display: block;
-  position: absolute;
-  left: 0px;
-  top: 100%;
-  right: 0px;
-  bottom: 0px;
-  z-index: -1;
-  cursor: default;
-  user-select: none;
-}
-
-.textLayer .endOfContent.active {
-  top: 0px;
-}
-
-#text-layer {
-   position: absolute;
-    left: 0;
-    top: 0;
-    right: 0;
-    bottom: 0;
-    overflow: hidden;
-    opacity: 0.2;
-    line-height: 1.0;
-}
-
-#text-layer > div {
-    color: transparent;
-    position: absolute;
-    white-space: pre;
-    cursor: text;
-    transform-origin: 0% 0%;
-}
-

+ 0 - 202
app/static/js/text_layer_builder.js

@@ -1,202 +0,0 @@
-/**
- * Code extracted from pdf.js' viewer.js file. This contains code that is relevant to building the text overlays. I
- * have removed dependencies on viewer.js and viewer.html.
- *
- *   -- Vivin Suresh Paliath (http://vivin.net)
- */
-
-var CustomStyle = (function CustomStyleClosure() {
-
-    // As noted on: http://www.zachstronaut.com/posts/2009/02/17/
-    //              animate-css-transforms-firefox-webkit.html
-    // in some versions of IE9 it is critical that ms appear in this list
-    // before Moz
-    var prefixes = ['ms', 'Moz', 'Webkit', 'O'];
-    var _cache = { };
-
-    function CustomStyle() {
-    }
-
-    CustomStyle.getProp = function get(propName, element) {
-        // check cache only when no element is given
-        if (arguments.length == 1 && typeof _cache[propName] == 'string') {
-            return _cache[propName];
-        }
-
-        element = element || document.documentElement;
-        var style = element.style, prefixed, uPropName;
-
-        // test standard property first
-        if (typeof style[propName] == 'string') {
-            return (_cache[propName] = propName);
-        }
-
-        // capitalize
-        uPropName = propName.charAt(0).toUpperCase() + propName.slice(1);
-
-        // test vendor specific properties
-        for (var i = 0, l = prefixes.length; i < l; i++) {
-            prefixed = prefixes[i] + uPropName;
-            if (typeof style[prefixed] == 'string') {
-                return (_cache[propName] = prefixed);
-            }
-        }
-
-        //if all fails then set to undefined
-        return (_cache[propName] = 'undefined');
-    };
-
-    CustomStyle.setProp = function set(propName, element, str) {
-        var prop = this.getProp(propName);
-        if (prop != 'undefined')
-            element.style[prop] = str;
-    };
-
-    return CustomStyle;
-})();
-
-var TextLayerBuilder = function textLayerBuilder(textLayerDiv, pageIdx) {
-    var textLayerFrag = document.createDocumentFragment();
-
-    this.textLayerDiv = textLayerDiv;
-    this.layoutDone = false;
-    this.divContentDone = false;
-    this.pageIdx = pageIdx;
-    this.matches = [];
-
-    this.beginLayout = function textLayerBuilderBeginLayout() {
-        this.textDivs = [];
-        this.renderingDone = false;
-    };
-
-    this.endLayout = function textLayerBuilderEndLayout() {
-        this.layoutDone = true;
-        this.insertDivContent();
-    };
-
-    this.renderLayer = function textLayerBuilderRenderLayer() {
-        var textDivs = this.textDivs;
-        var bidiTexts = this.textContent.bidiTexts;
-        var textLayerDiv = this.textLayerDiv;
-        var canvas = document.createElement('canvas');
-        var ctx = canvas.getContext('2d');
-
-        // No point in rendering so many divs as it'd make the browser unusable
-        // even after the divs are rendered
-        var MAX_TEXT_DIVS_TO_RENDER = 100000;
-        if (textDivs.length > MAX_TEXT_DIVS_TO_RENDER)
-            return;
-
-        for (var i = 0, ii = textDivs.length; i < ii; i++) {
-            var textDiv = textDivs[i];
-            if ('isWhitespace' in textDiv.dataset) {
-                continue;
-            }
-            textLayerFrag.appendChild(textDiv);
-
-            ctx.font = textDiv.style.fontSize + ' ' + textDiv.style.fontFamily;
-            var width = ctx.measureText(textDiv.textContent).width;
-
-            if (width > 0) {
-                var textScale = textDiv.dataset.canvasWidth / width;
-
-                var transform = 'scale(' + textScale + ', 1)';
-                if (bidiTexts[i].dir === 'ttb') {
-                    transform = 'rotate(90deg) ' + transform;
-                }
-                CustomStyle.setProp('transform', textDiv, transform);
-                CustomStyle.setProp('transformOrigin', textDiv, '0% 0%');
-
-                textLayerDiv.appendChild(textDiv);
-            }
-        }
-
-        this.renderingDone = true;
-
-        textLayerDiv.appendChild(textLayerFrag);
-    };
-
-    this.setupRenderLayoutTimer = function textLayerSetupRenderLayoutTimer() {
-        // Schedule renderLayout() if user has been scrolling, otherwise
-        // run it right away
-        var RENDER_DELAY = 200; // in ms
-        var self = this;
-        //0 was originally PDFView.lastScroll
-        if (Date.now() - 0 > RENDER_DELAY) {
-            // Render right away
-            this.renderLayer();
-        } else {
-            // Schedule
-            if (this.renderTimer)
-                clearTimeout(this.renderTimer);
-            this.renderTimer = setTimeout(function () {
-                self.setupRenderLayoutTimer();
-            }, RENDER_DELAY);
-        }
-    };
-
-    this.appendText = function textLayerBuilderAppendText(geom) {
-        var textDiv = document.createElement('div');
-
-        // vScale and hScale already contain the scaling to pixel units
-        var fontHeight = geom.fontSize * Math.abs(geom.vScale);
-        textDiv.dataset.canvasWidth = geom.canvasWidth * geom.hScale;
-        textDiv.dataset.fontName = geom.fontName;
-
-        textDiv.style.fontSize = fontHeight + 'px';
-        textDiv.style.fontFamily = geom.fontFamily;
-        textDiv.style.left = geom.x + 'px';
-        textDiv.style.top = (geom.y - fontHeight) + 'px';
-
-        // The content of the div is set in the `setTextContent` function.
-
-        this.textDivs.push(textDiv);
-    };
-
-    this.insertDivContent = function textLayerUpdateTextContent() {
-        // Only set the content of the divs once layout has finished, the content
-        // for the divs is available and content is not yet set on the divs.
-        if (!this.layoutDone || this.divContentDone || !this.textContent)
-            return;
-
-        this.divContentDone = true;
-
-        var textDivs = this.textDivs;
-        var bidiTexts = this.textContent.bidiTexts;
-
-        for (var i = 0; i < bidiTexts.length; i++) {
-            var bidiText = bidiTexts[i];
-            var textDiv = textDivs[i];
-            if (!/\S/.test(bidiText.str)) {
-                textDiv.dataset.isWhitespace = true;
-                continue;
-            }
-
-            textDiv.textContent = bidiText.str;
-            // bidiText.dir may be 'ttb' for vertical texts.
-            textDiv.dir = bidiText.dir === 'rtl' ? 'rtl' : 'ltr';
-        }
-
-        this.setupRenderLayoutTimer();
-    };
-
-    this.setTextContent = function textLayerBuilderSetTextContent(textContent) {
-        this.textContent = textContent;
-        this.insertDivContent();
-    };
-};
-
-/**
- * Returns scale factor for the canvas. It makes sense for the HiDPI displays.
- * @return {Object} The object with horizontal (sx) and vertical (sy)
- scales. The scaled property is set to false if scaling is
- not required, true otherwise.
- */
-function getOutputScale() {
-    var pixelRatio = 'devicePixelRatio' in window ? window.devicePixelRatio : 1;
-    return {
-        sx: pixelRatio,
-        sy: pixelRatio,
-        scaled: pixelRatio != 1
-    };
-}

+ 0 - 53
app/static/js/textlayer_pdfjs.js

@@ -1,53 +0,0 @@
-/* Copyright 2014 Mozilla Foundation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-'use strict';
-
-if (!pdfjsLib.getDocument || !pdfjsViewer.PDFPageView) {
-  alert('Please build the pdfjs-dist library using\n' +
-        '  `gulp dist-install`');
-}
-
-
-var DEFAULT_URL = {{og_filename}};
-var PAGE_TO_VIEW = 1;
-var SCALE = 1.0;
-
-var container = document.getElementById('pageContainer');
-
-// Loading document.
-var loadingTask = pdfjsLib.getDocument({
-  url: DEFAULT_URL,
-  cMapUrl: CMAP_URL,
-  cMapPacked: CMAP_PACKED,
-});
-loadingTask.promise.then(function(pdfDocument) {
-  // Document loaded, retrieving the page.
-  return pdfDocument.getPage(PAGE_TO_VIEW).then(function (pdfPage) {
-    // Creating the page view with default parameters.
-    var pdfPageView = new pdfjsViewer.PDFPageView({
-      container: container,
-      id: PAGE_TO_VIEW,
-      scale: SCALE,
-      defaultViewport: pdfPage.getViewport({ scale: SCALE, }),
-      // We can enable text/annotations layers, if needed
-      textLayerFactory: new pdfjsViewer.DefaultTextLayerFactory(),
-      annotationLayerFactory: new pdfjsViewer.DefaultAnnotationLayerFactory(),
-    });
-    // Associates the actual page with the view, and drawing it
-    pdfPageView.setPdfPage(pdfPage);
-    return pdfPageView.draw();
-  });
-});

+ 0 - 11
app/templates/display_results.html

@@ -1,11 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="UTF-8">
-    <title>Title</title>
-
-</head>
-<body>
-
-</body>
-</html>

+ 2 - 4
app/templates/index.html

@@ -37,11 +37,9 @@
 
     <script type="text/javascript" src="{{ url_for('static', filename='js/js_libs/ui.js') }}"></script>
     <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/ui.css') }}" type="text/css"/>
+      <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/cdp_ui.css') }}" type="text/css"/>
 
-    <link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/cdp_ui.css') }}" type="text/css"/>
-
-    <!--<link   rel="stylesheet"      href="{{ url_for('static', filename='js/js_libs/css/ui.css') }}" type="text/css"/>-->
-    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css"/>
+      <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}" type="text/css"/>
     <link rel="stylesheet" href="{{ url_for('static', filename='css/layout.css') }}" type="text/css"/>
 
   <body is="x-ui">

app/templates/show_image_old_working.html → app/templates/index_old.html


+ 0 - 114
app/templates/pdf_textlayer.html

@@ -1,114 +0,0 @@
-<!DOCTYPE html><meta charset="utf-8"/>
-
-<!--<script type="javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.3.200/pdf.js"></script> das funktioniert!!!!!
-<script type="javascript" src="https://unpkg.com/pdfjs-dist@latest/build/pdf.js" ></script>
-<script type="javascript" src="{{ url_for('static', filename='js/pdf.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>
--->
-
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/build/pdf.min.js"></script>
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/web/pdf_viewer.js"></script>
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/build/pdf.js"></script>
-<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>
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.2.228/web/pdf_viewer.css">
-<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}"/>
-<link rel="stylesheet" href="{{ url_for('static', filename='css/text_layer_builder.css') }}" />
-
-
-
-<body>
-<div id="container" > {{og_filename}}</div>
-<div id="text-layer"></div>
-<script>
-
-
-var og_filename = "{{og_filename}}";
-var url = "{{ url_for('send_file', filename=og_filename) }}";
-console.log(og_filename);
-
-var pdfjsLib = window['pdfjs-dist/build/pdf'];
-
-pdfjsLib.getDocument(url)
-  .promise.then(function(pdf) {
-
-    // Get div#container and cache it for later use
-    var container = document.getElementById("container");
-
-    // Loop from 1 to total_number_of_pages in PDF document
-    for (var i = 1; i <= pdf.numPages; i++) {
-
-        // Get desired page
-        pdf.getPage(i).then(function(page) {
-
-          var scale = 1.5;
-          var viewport = page.getViewport({scale: scale});
-          var div = document.createElement("div");
-
-          // Set id attribute with page-#{pdf_page_number} format
-          div.setAttribute("id", "page-" + (page.pageIndex + 1));
-
-          // This will keep positions of child elements as per our needs
-          div.setAttribute("style", "position: relative");
-
-          // Append div within div#container
-          container.appendChild(div);
-
-          // Create a new Canvas element
-          var canvas = document.createElement("canvas");
-
-          // Append Canvas within div#page-#{pdf_page_number}
-          div.appendChild(canvas);
-
-          var context = canvas.getContext('2d');
-          canvas.height = viewport.height;
-          canvas.width = viewport.width;
-
-          var renderContext = {
-            canvasContext: context,
-            viewport: viewport
-          };
-
-          // Render PDF page
-         page.render(renderContext).promise.then(function() {
-    // Returns a promise, on resolving it will return text contents of the page
-    return page.getTextContent();
-}).then(function(textContent) {
-     // PDF canvas
-    var pdf_canvas = $("#canvas");
-
-    // Canvas offset
-    var canvas_offset = pdf_canvas.offset();
-
-    // Canvas height
-    var canvas_height =  canvas.height;
-
-    // Canvas width
-    var canvas_width = canvas.width;
-
-    // Assign CSS to the text-layer element
-    $("#text-layer").css({ left: canvas_offset.left + 'px', top: canvas_offset.top + 'px', height: canvas_height + 'px', width: canvas_width + 'px' });
-
-    // Pass the data to the method for rendering of text over the pdf canvas.
-    PDFJS.renderTextLayer({
-        textContent: textContent,
-        container: $("#text-layer").get(0),
-        viewport: viewport,
-        textDivs: []
-    });
-});
-
-
-        });
-
-    }
-
-});
-
-
-
-</script>
-</body>
-</html>

+ 0 - 114
app/templates/show_pdf.html

@@ -1,114 +0,0 @@
-<!DOCTYPE html><meta charset="utf-8"/>
-
-<!--<script type="javascript" src="//cdnjs.cloudflare.com/ajax/libs/pdf.js/2.3.200/pdf.js"></script> das funktioniert!!!!!
-<script type="javascript" src="https://unpkg.com/pdfjs-dist@latest/build/pdf.js" ></script>
-<script type="javascript" src="{{ url_for('static', filename='js/pdf.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>
--->
-
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/build/pdf.min.js"></script>
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/web/pdf_viewer.js"></script>
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/build/pdf.js"></script>
-<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>
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
-<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/pdfjs-dist@1.9/web/pdf_viewer.css">
-<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}"/>
-<link rel="stylesheet" href="{{ url_for('static', filename='css/text_layer_builder.css') }}" />
-
-
-
-<body>
-<div id="container" > {{og_filename}}</div>
-<div id="text-layer"></div>
-<script>
-
-
-var og_filename = "{{og_filename}}";
-var url = "{{ url_for('send_file', filename=og_filename) }}";
-console.log(og_filename);
-
-var pdfjsLib = window['pdfjs-dist/build/pdf'];
-
-pdfjsLib.getDocument(url)
-  .promise.then(function(pdf) {
-
-    // Get div#container and cache it for later use
-    var container = document.getElementById("container");
-
-    // Loop from 1 to total_number_of_pages in PDF document
-    for (var i = 1; i <= pdf.numPages; i++) {
-
-        // Get desired page
-        pdf.getPage(i).then(function(page) {
-
-          var scale = 1.5;
-          var viewport = page.getViewport({scale: scale});
-          var div = document.createElement("div");
-
-          // Set id attribute with page-#{pdf_page_number} format
-          div.setAttribute("id", "page-" + (page.pageIndex + 1));
-
-          // This will keep positions of child elements as per our needs
-          div.setAttribute("style", "position: relative");
-
-          // Append div within div#container
-          container.appendChild(div);
-
-          // Create a new Canvas element
-          var canvas = document.createElement("canvas");
-
-          // Append Canvas within div#page-#{pdf_page_number}
-          div.appendChild(canvas);
-
-          var context = canvas.getContext('2d');
-          canvas.height = viewport.height;
-          canvas.width = viewport.width;
-
-          var renderContext = {
-            canvasContext: context,
-            viewport: viewport
-          };
-
-          // Render PDF page
-         page.render(renderContext).promise.then(function() {
-    // Get text-fragments
-    return page.getTextContent();
-  })
-
-  .then(function(textContent) {
-    // Create div which will hold text-fragments
-    console.log(textContent);
-    var textLayerDiv = document.createElement("div");
-
-    // Set it's class to textLayer which have required CSS styles
-    textLayerDiv.setAttribute("class", "textLayer");
-
-    // Append newly created div in `div#page-#{pdf_page_number}`
-    div.appendChild(textLayerDiv);
-
-    // Create new instance of TextLayerBuilder class
-    var textLayer = new TextLayerBuilder({
-      textLayerDiv: textLayerDiv,
-      pageIndex: page.pageIndex,
-      viewport: viewport
-    });
-
-    // Set text-fragments
-    textLayer.setTextContent(textContent);
-
-    // Render text-fragments
-    textLayer.render();
-  });
-        });
-
-      }
-
-});
-
-
-
-</script>
-</body>
-</html>

+ 0 - 40
app/templates/test_pdfjs_textlayer.html

@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<!--
-Copyright 2014 Mozilla Foundation
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-    http://www.apache.org/licenses/LICENSE-2.0
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-<html dir="ltr" mozdisallowselectionprint>
-<head>
-  <meta charset="utf-8">
-  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
-  <meta name="google" content="notranslate">
-  <title>PDF.js page viewer using built components</title>
-
-  <style>
-    body {
-      background-color: #808080;
-      margin: 0;
-      padding: 0;
-    }
-  </style>
-
-  <link rel="stylesheet" href="{{ url_for('static', filename='css/viewer.css') }}" />
-
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.2.2/web/pdf_viewer.js"></script>
-<script src="https://cdn.jsdelivr.net/npm/pdfjs-dist@2.2.2/build/pdf.js"></script>
-</head>
-
-<body tabindex="1">
-  <div id="pageContainer" class="pdfViewer singlePageView"></div>
-
-  <script src="pageviewer.js"></script>
-</body>
-</html>

+ 0 - 1
app/templates/viewer.html

@@ -1 +0,0 @@
-<a href="/web/viewer.html?file=app">Open yourpdf.pdf with PDF.js</a>

+ 0 - 68
app/views.py

@@ -5,13 +5,10 @@ import subprocess
 import redis
 import random
 import PyPDF2
-import json
-import base64
 import os
 import json
 import re
 import base64
-#https://medium.com/@emerico/convert-pdf-to-image-using-python-flask-2864fb655e01
 
 #path = "/home/bscheibel/app/app"
 path = "/home/centurio/Projects/engineering_drawings_ui/app/app"
@@ -33,7 +30,6 @@ def convert_pdf_img(filename):
                      PDFFILE, path + '/temporary/out'])
 
 def extract_all(uuid, filename, db):
-    #order_bounding_boxes_in_each_block.main(uuid, UPLOAD_FOLDER + "/" + filename)
     subprocess.call(['python3', path_extraction, str(uuid),UPLOAD_FOLDER + "/" + filename, db, str(0)])
 
 def get_file_size(file):
@@ -51,19 +47,6 @@ def get_file_size(file):
     print(w,h,OrientationDegrees)
     return w,h, orientation
 
-
-
-
-def check_config_file(d):
-    reg_search = d
-    #print(reg_search)
-
-    for conf in d:
-        print(conf)
-
-    return "blub"
-
-
 def check_links(isos):
     link_names = {}
     isos_names = []
@@ -74,7 +57,6 @@ def check_links(isos):
     for name in isos:
         if re.search(reg_isos, name):
             n = 1
-            #print(name)
             new_isos = re.search(reg_isos,name).group(1)
             number = re.search(reg_isos,name).group(2)
             while n <= int(number):
@@ -85,16 +67,10 @@ def check_links(isos):
     for name in isos_new:
         try:
             name = name.replace(" ", "")
-            #name = name.replace("-"," ")
             url1 = name + ".PDF"
-            #print(url)
-            file = send_from_directory("static/isos",url1)
             url = "isos/" + url1
-            #link_names.append(url)
             link_names[name] = url
-            #print(link_names)
         except:
-            #print(name)
             isos_names.append(name)
     return link_names, isos_names
 
@@ -123,15 +99,10 @@ def upload_file():
 @app.route('/show/<filename>&<uuid>')
 def uploaded_file(filename, uuid):
     file_out = "out.jpg"
-    #file_out = filename
-    #if request.method == 'POST':
-    #    uuid = 433
     if filename.endswith(".pdf") or filename.endswith(".PDF"):
         w,h, orientation = get_file_size(UPLOAD_FOLDER +"/" + filename)
         convert_pdf_img(filename)
         db = redis.Redis("localhost")
-        #isos = db.get(uuid+"dims")
-        #print(iso)
         gen_tol = db.get(str(uuid)+"tol")
         print(gen_tol)
         isos = json.loads(db.get(str(uuid)+"isos"))
@@ -142,16 +113,12 @@ def uploaded_file(filename, uuid):
         html_code = "General tolerances according to: " + gen_tol + "<br>"
         html_general = ""
         reg = r"(-?\d{1,}\.?\d*)"
-        #re_gewinde = r"M\d{1,2}"
-        #re_passungen = r"h\d{1,2}|H\d{1,2}"
         det_coords= "0,0,0,0"
         with open(path+ '/config.json') as f:
             config_file = json.load(f)
 
         for dim in sorted(dims):
-            #print(dim)
             for det in details:
-                #print(det)
                 try:
                     if dim == det:
                         det_coords = details[det]
@@ -168,16 +135,6 @@ def uploaded_file(filename, uuid):
                 relevant_isos = []
                 search_terms = {}
                 terms = ''
-                #if "Ra" in d or "Rz" in d or "Rpk" in d:
-                #    relevant_isos.append("ISO4287.PDF")
-                #if u"\u27C2" in d or u"\u25CE" in d or u"\u232D" in d or u"\u2225" in d or u"\u232F" in d or u"\u2316" in d or u"\u2313" in d or u"\u23E5" in d:
-                #    relevant_isos.append("ISO1101.PDF")
-                #if re.search(re_gewinde,d):
-                #    relevant_isos.append("ISO6410.PDF")
-                #if "GG" in d or "CT" in d or "GX" in d:
-                #    relevant_isos.append("ISO14405-1.PDF")
-                #if re.search(re_passungen,d):
-                #    relevant_isos.append("ISO286-1.PDF")
                 for conf in config_file:
                     if re.search(conf,d):
                         iso = config_file[conf]
@@ -185,17 +142,10 @@ def uploaded_file(filename, uuid):
                             relevant_isos.append(key)
                             for blub in iso[key]:
                                 search_terms[blub] = iso[key][blub]
-
-                        #terms = '{"Symbole":1,"Tabelle":2,"Definition":3}'
                         if len(search_terms) < 1:
                             search_terms["Beginn"] = 1
                         terms = json.dumps(search_terms)
-                        #print(terms)
                         terms = base64.b64encode(terms.encode())
-                        #terms = "blub"
-
-
-
                 try:
                     number = re.search(reg, d)
                     number = number.group(1)
@@ -221,31 +171,19 @@ def uploaded_file(filename, uuid):
 
                 relevant_isos = list(set(relevant_isos))
                 for x in relevant_isos:
-                    #html_code += "<td style='text-align:left'> <a href=" + url_for('static', filename="isos/"+x) + " >"+ x.partition(".")[0]  +"</a>  </td>"
                     html_code += "<td style='text-align:left' data-terms='" + terms + "'> <a onclick=ui_add_tab_active('#main','" + x.partition(".")[0] + "','" + x.partition(".")[0] +"',true,'isotab','"+terms+"')>" + x.partition(".")[0] + "</a>  </td>"
-                #print(html_code)
                 html_code += "</tr>"
                 html_links = ""
                 for link in links:
                     html_links += "<a onclick =ui_add_tab_active('#main','" + link + "','" + link +"',true,'isotab','empty')> Open " + link + "</a> <br>"
-                    #html_links += "<tr> <td> <a onclick =ui_add_tab_active('#main','iso1','iso1',true,'isotab')> Open " + link + " in Tab </a> </td> </tr>"""
-        #print("teeest")
         return render_template('index.html', filename=file_out, isos=isos, dims=dims, text=html_code,html_general=html_general, number=number_blocks, og_filename=filename, w=w, h=h, html_links=html_links, isos_names=isos_names, orientation=orientation)
-    #return render_template('test_pdfjs_textlayer.html', og_filename=filename)
-
-    #else:
-    #    filename = filename
-    #    return render_template('show_image.html', filename=filename)
-
 
 @app.route('/uploads/<filename>')
 def send_file(filename):
     return send_from_directory(UPLOAD_FOLDER, filename)
 
-# No caching at all for API endpoints.
 @app.after_request
 def add_header(response):
-    # response.cache_control.no_store = True
     response.headers['Cache-Control'] = 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0, max-age=0'
     response.headers['Pragma'] = 'no-cache'
     response.headers['Expires'] = '-1'
@@ -282,9 +220,3 @@ def redis_set(key):
         db.set(key, json_dict)
     return "OK"
 
-
-
-@app.route('/index')
-def test():
-    return render_template('index.html')
-