File sourceFilePath = documentService.getSourceDocumentFile(sourceDocument); FileUtils.copyInputStreamToFile(zip.getInputStream(entry), sourceFilePath);
File sourceFilePath = documentService.getSourceDocumentFile(sourceDocument); FileUtils.copyInputStreamToFile(zip.getInputStream(entry), sourceFilePath);
@Override protected void respond(AjaxRequestTarget aTarget) { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); try { String pdftext = PDFExtractor.processFileToString(pdfFile, false); PdfAnnoModel pdfAnnoModel = aPdfAnnotationEditor.renderPdfAnnoModel(aTarget, pdftext); String script = getAnnotationsJS(pdfAnnoModel); aTarget.appendJavaScript(script); } catch (IOException e) { log.error("Unable to get PDF text for [{}]", pdfFile.getName() + "with PDFExtractor.", e); error("Unable to get PDF text for " + pdfFile.getName() + "with PDFExtractor."); aTarget.addChildren(getPage(), IFeedback.class); } } });
File docFile = documentService.getSourceDocumentFile(doc); FileSystemResource resource = new FileSystemResource(docFile); HttpHeaders httpHeaders = new HttpHeaders();
@Override public void onRequest() { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); try { String pdftext = PDFExtractor.processFileToString(pdfFile, false); getRequestCycle().scheduleRequestHandlerAfterCurrent( new ResourceStreamRequestHandler( new StringResourceStream(pdftext)) ); } catch (IOException e) { log.error("Unable to get PDF text for " + pdfFile.getName() + "with PDFExtractor.", e); } } });
private JCas createOrReadInitialCasWithoutSaving(SourceDocument aDocument, LogMessageSet aMessageSet) throws IOException, UIMAException { JCas cas; if (casStorageService.existsCas(aDocument, INITIAL_CAS_PSEUDO_USER)) { cas = casStorageService.readCas(aDocument, INITIAL_CAS_PSEUDO_USER, false); } else { cas = importExportService.importCasFromFile( documentService.getSourceDocumentFile(aDocument), aDocument.getProject(), aDocument.getFormat()); aMessageSet.messages.add(new LogMessage(getClass(), LogLevel.INFO, "Created initial CAS for [" + aDocument.getName() + "]")); } return cas; }
@Override public void onRequest() { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); try { String pdftext = PDFExtractor.processFileToString(pdfFile, false); getRequestCycle().scheduleRequestHandlerAfterCurrent( new ResourceStreamRequestHandler( new StringResourceStream(pdftext)) ); } catch (IOException e) { log.error("Unable to get PDF text for [{}]", pdfFile.getName() + "with PDFExtractor.", e); } } });
File docFile = documentService.getSourceDocumentFile(doc); FileSystemResource resource = new FileSystemResource(docFile); HttpHeaders httpHeaders = new HttpHeaders();
@Override public void onRequest() { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); getRequestCycle().scheduleRequestHandlerAfterCurrent( new ResourceStreamRequestHandler(new FileResourceStream(pdfFile), doc.getName())); } });
@Override public void onRequest() { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); getRequestCycle().scheduleRequestHandlerAfterCurrent( new ResourceStreamRequestHandler(new FileResourceStream(pdfFile), doc.getName())); } });
private JCas createOrReadInitialCasWithoutSaving(SourceDocument aDocument, LogMessageSet aMessageSet) throws IOException, UIMAException { JCas cas; if (casStorageService.existsCas(aDocument, INITIAL_CAS_PSEUDO_USER)) { cas = casStorageService.readCas(aDocument, INITIAL_CAS_PSEUDO_USER, false); } else { cas = importExportService.importCasFromFile( documentService.getSourceDocumentFile(aDocument), aDocument.getProject(), aDocument.getFormat()); aMessageSet.messages.add(new LogMessage(getClass(), LogLevel.INFO, "Created initial CAS for [" + aDocument.getName() + "]")); } return cas; }
for (SourceDocument sourceDocument : documents) { try { FileUtils.copyFileToDirectory(documentService.getSourceDocumentFile(sourceDocument), sourceDocumentDir); aRequest.progress = (int) Math.ceil(((double) i) / documents.size() * 10.0);
@Override protected void respond(AjaxRequestTarget aTarget) { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); try { String pdftext = PDFExtractor.processFileToString(pdfFile, false); boolean success = aPdfAnnotationEditor.createSpanAnnotation(aTarget, getRequest(), pdftext); if (success) { PdfAnnoModel model = aPdfAnnotationEditor.renderPdfAnnoModel(aTarget, pdftext); String script = getAnnotationsJS(model); aTarget.appendJavaScript(script); } } catch (IOException e) { log.error("Unable to get PDF text for [{}]", pdfFile.getName() + "with PDFExtractor.", e); aTarget.addChildren(getPage(), IFeedback.class); } } });
for (SourceDocument sourceDocument : documents) { try { FileUtils.copyFileToDirectory(documentService.getSourceDocumentFile(sourceDocument), sourceDocumentDir); aRequest.progress = (int) Math.ceil(((double) i) / documents.size() * 10.0);
@Override protected void respond(AjaxRequestTarget aTarget) { SourceDocument doc = aModel.getObject().getDocument(); File pdfFile = documentService.getSourceDocumentFile(doc); try { String pdftext = PDFExtractor.processFileToString(pdfFile, false); PdfAnnoModel pdfAnnoModel = aPdfAnnotationEditor.renderPdfAnnoModel(pdftext); String script = "setTimeout(function() { " + "var annoFile = `\n" + pdfAnnoModel.getAnnoFileContent() + "`;\n" + "pdfanno.contentWindow.annoPage.importAnnotation({" + "'primary': true," + "'colorMap': " + JSONUtil.toJsonString(pdfAnnoModel.getColorMap()) + "," + "'annotations':[annoFile]}, true);" + "}, 10);"; aTarget .appendJavaScript(script); } catch (IOException e) { log.error("Unable to get PDF text for " + pdfFile.getName() + "with PDFExtractor.", e); error("Unable to get PDF text for " + pdfFile.getName() + "with PDFExtractor."); aTarget.addChildren(getPage(), IFeedback.class); } } });