Sign up to take part
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Registered users can ask their own questions, contribute to discussions, and be part of the Community!
Hi Folks!
Thanks in advance.
I am using dataiku since last 4 months for a standard webapp type project in Dataiku.
I want to render a pdf file into frontend from the local dataiku directory. I have got the path and name of file from below get_pdfs function and trying to display pdf file into html with #pdfpara id. When I run the code, I get the 404 page not found error while I have used correct path and file name.
Please let me know where I am doing wrong. Below is the code for the refference.
backend.py
---------------------------------------------------------------------------------
def get_pdfs():
import dataiku
handle = dataiku.Folder("PDF_DATA_V2")
path = handle.get_path()
list_pdfs = handle.list_paths_in_partition()//In this variable around 2K pdfs are listed.
first_pdf = list_pdf[0]
b = path + first_pdf
return b
--------------------------------------------------------------------------------------
js.py
------------------------------------------------------------------------------------
let pdfvar = document.getElementById("pdfpara");
$(document).ready(function showPdfs(){
$.get(getWebAppBackendUrl('get_pdfs'), function(b){
console.log(b);
pdfvar.innerHTML = `<embed src="${b}" type="application/pdf" width="100%" height="500px">`;
------------------------------------------------------------------------------------------------
index.html
-----------------------------------------------------------------------
<div id = "pdfContainer">
<p id ="pdfpara">
this is space to show the pdf file
</p>
</div>
Operating system used: windows 10