I would like to use this component, therefore I installed the corresponding Solution “sysPDFViewerExample”
Displaying website like ‘www.spiegel.de’ as ‘http:www.spiegel.de’ works fine, also PDFs located in the web
But I want to display a local PDF on my machine
Checking the dokumentation
it says "Load document using URL which is relative to the web applications’s root context
In my case on the developer pc:
F:\Eigene Dateien\servoy_workspace_2022\svyPDFViewerExample\medias\test.pdf
therefore:
‘http://localhost:8080 medias/test.pdf’ but, does not work
I got the tip (new Port) to use 8183
But I didn’t work, also not working with the full path
I don’t think the Media-Files show up in the server like that.
You could create a temporary file and “copy” the contents
var file = plugins.file.createTempFile('test','.pdf')
file.setBytes(plugins.http.getMediaData("media:///test.pdf"),true)
var url = plugins.file.getUrlForRemoteFile(file)
pdfForm.elements.pdf_Viewer.documentURL = url;
(i didn’t test that, though, and I’m notoriously bad with files…)
We do it a bit differently, we have a form-variable on the pdf-form, which is bound to the dataProvider-property of the component. We use this method to display reports from Jasper Reports, since we get the data not as files but as bytes, so we avoid creating / handling / deleting temp-files on the server.
Files that you want to work with locally (which I mean files that are local on the Servoy server, or your developer when testing), should really be located in (or moved to at runtime) plugins.file.getDefaultUploadLocation(). Which is something like C:\users{username}.servoy\uploads{guid}\
Personally, I’d put them in a subfolder, like “templates” or something, so its at C:\users{username}.servoy\uploads{guid\templates\test.pdf
thanks a lot.
I am used to work with the jasperplugin for datadriven pdf
But this case ist much more simple, the PDF is ready and fixed, I just want display the content in a window in my application
I thought the pdfviewer would be perfect for this case and it works
a) showing a URL (https://www.spiegel.de/)
b) showing a pdf located in the internet (http://www.alkenbrecher.com/assets/Sapp … ersion.pdf)
but if the file is located on my developer machine it doesnt work / find the file,
WIKI says in developer use “http://localhost: 8183/reports/test.pdf” - but test.pdf is not displayed
my whole path on a windows computer: F:\Eigene Dateien\servoy_workspace_2022\svyPDFViewerExample\medias\test.pdf
The files from “http://localhost: 8183/” are not in your workspace, this is only where your settings / source / webcomponents may or may not reside.
The web-root of your tomcat-server is the ROOT-folder in your Servoy-Developer, somewhere under application_server. On my machine it’s “/Applications/Servoy_2021.12.0.app/Contents/application_server/server/webapps/ROOT”, but your path will be diffrent on a windows-machine.