vaadin-component-factory / vcf-pdf-viewer-flow

Vaadin Addon for providing pdf viewing functionality
Apache License 2.0
9 stars 6 forks source link

Invalid Pdf Structure #35

Open Lzm010409 opened 1 year ago

Lzm010409 commented 1 year ago

Hi, I've a little issue implementing your Vaadin Component. I would like to display a pdf on my page. Unfortunately the log always shows me the error "invalid Pdf structure". At first I thought it might be due to the presence of form fields. Then I tried to display a simple document using your PDF viewer, but without success. I have also tried both input methods: StreamRessource and Absolute path of the file. Unfortunately without success. I would really like to use your extension, especially because we work a lot with pdfs, but unfortunately I don't really get anywhere. I have attached the code snipped and also some screenshots, maybe you can find the time to give me a short feedback.

`PdfViewer pdfViewer = new PdfViewer();

    pdfViewer.setSrc("/Users/lukegollenstede/Downloads/Rechnung_3692157276.pdf");
    pdfViewer.setSizeFull();
    add(pdfViewer);`
Bildschirm­foto 2023-03-26 um 16 48 56 Bildschirm­foto 2023-03-26 um 16 47 50

Thank you in advance...

paodb commented 1 year ago

Hello, did you take a look at the examples on the demo on how the resource is set? See example and files location.

If you wish to use the setSrc method only setting an url for the file please take in consideration that the file should be on the same server as where the component is run, so that's why your test is not working. Something like this pdfViewer.setSrc("/frontend/pdf/example.pdf"); where the frontend folder path is src\main\resources\META-INF\resources\frontend should work.