Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » Viewing/rendering PDF file(Generating reports using PDF file.)
Viewing/rendering PDF file [message #1805999] Tue, 30 April 2019 10:03 Go to next message
Mark Novem Grisola is currently offline Mark Novem GrisolaFriend
Messages: 27
Registered: November 2017
Junior Member
hello Mat,

Good day.

I want to render a pdf file for a report just like the example from the old version of scout, but i having a problem because the Interface IShell (eclipse.scout.rt.shared-2013-02-06_S-3.8.2RC3) does not exist anymore. What i was thinking, may be if i could just include the specific jar package were the IShell exist into my project it may solve my problem. Is it a good idea? or is there any latest example of eclipse scout for generating report were i can look on to? i am using JasperSoft Studio as my third party.

I would be very much happy and glad if you can share a little of your time for assisting my concern.

sincerely,

Mark
Re: Viewing/rendering PDF file [message #1806005 is a reply to message #1805999] Tue, 30 April 2019 10:42 Go to previous messageGo to next message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Hi Mark. Which version of Scout do you use now? Since v5.1 Scout is a web-framework. It does not have any built-in facility to create PDF files, but you may use whatever tool or library best fits your requirements to do that.

The important part is: you must create the PDF document on the UI server and download that document from there. I'd recommend to store the PDF document in a org.eclipse.scout.rt.platform.resource.BinaryResource and call the method AbstractDesktop#openUri(BinaryResource res, IOpenUriAction openUriAction). This causes the Scout client which runs in the browser, to download the given PDF document (BinaryResource).

Open source Scout has no PDF viewer widget, so you must provide a custom widget or -field for that. I'd recommend to use PDF.JS, or (if you don't need to support older browsers) you could try to use an AbstractHtmlField, set the BinaryResource as an attachment and use the EMBED tag.



Eclipse Scout Homepage | Documentation | GitHub
Re: Viewing/rendering PDF file [message #1806031 is a reply to message #1806005] Wed, 01 May 2019 05:47 Go to previous messageGo to next message
Mark Novem Grisola is currently offline Mark Novem GrisolaFriend
Messages: 27
Registered: November 2017
Junior Member
Hello Andre,

Thank you for a quick reply. Actually i am using version 8 of scout and when i done with my problem (report genertion) i am gonna move into version 9.0. I am using the old version of scout (3.0) as a reference only for generating pdf report.

Yeah, i think, what you just suggested about the location or placement of report is a nice method & your recommendation its already a lot of information for me..

Thank you so much Andre.

Sincerely,

Mark
Re: Viewing/rendering PDF file [message #1827160 is a reply to message #1806031] Fri, 08 May 2020 14:31 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 128
Registered: June 2014
Location: Paris
Senior Member
Hello Andre,
I am trying to open pdf file in AbstractHtmlField and I came across this thread, I do not know what do you mean by using EMBED tag, can you provide sample code ?
Kind Regards
Re: Viewing/rendering PDF file [message #1827376 is a reply to message #1805999] Wed, 13 May 2020 20:09 Go to previous messageGo to next message
Krzysztof Leja is currently offline Krzysztof LejaFriend
Messages: 55
Registered: April 2019
Member
Hi,
I suspect Andre might have meant something like this:
public class PDFHTMLField extends AbstractHtmlField {
		@Override
		protected void execInitField() {
				String htmlContent = "<object data=\"binaryResource:" + pdfContent.getFilename() + "\" type=\"application/pdf\" width=\"100%\" height=\"100%\" style=\"flex: 1\"><p>No PDF file</p></object>";
				addAttachment(pdfContent);
				setValue(htmlContent);
		}

....
}


Where pdfContent is BinaryResource instance, with loaded pdf file.
I use something like this in my application to display PDF's generated with Jasper Reports.
Re: Viewing/rendering PDF file [message #1827669 is a reply to message #1827376] Wed, 20 May 2020 11:11 Go to previous messageGo to next message
Oueslati Anis is currently offline Oueslati AnisFriend
Messages: 128
Registered: June 2014
Location: Paris
Senior Member
Thanks it is working perfectly
Re: Viewing/rendering PDF file [message #1842954 is a reply to message #1827669] Wed, 07 July 2021 16:52 Go to previous messageGo to next message
Heita Woorb is currently offline Heita WoorbFriend
Messages: 1
Registered: July 2021
Junior Member
Oh, I was trying to do the same thing as Oueslati AnisFriend and i had no idea what was the sample code for the EMBED tag. And it is actually working if I am using that code, that is great, thank you very much guys! By the way guys, if I really need to render a pdf file for a report, how should I do it?! I tried to use the 8th version of scout however it does not work out. Since it did not work, I choose to open it and edit online on https://pdfliner.com/ as it is the best online pdf editor. It works in there, but when I am trying to upload it, the receiver cannot open it. What should I do?!

[Updated on: Fri, 09 July 2021 14:32]

Report message to a moderator

Re: Viewing/rendering PDF file [message #1843203 is a reply to message #1842954] Tue, 20 July 2021 06:41 Go to previous message
Andre Wegmueller is currently offline Andre WegmuellerFriend
Messages: 204
Registered: September 2012
Location: Baden-Dättwil, Switzerla...
Senior Member
Hi Heita

As I said in my post above: Eclipse Scout does not have any built-in facility to create PDF files, but you may use whatever tool or Java library best fits your requirements to do that.
Since this forum is about Eclipse Scout, we cannot give you advice on external libraries, but maybe this is a good starting point for you.

For the same reason, we cannot answer questions about tools like pdfliner, please check the support section/forum for that specific tool.

Cheers,
André


Eclipse Scout Homepage | Documentation | GitHub

[Updated on: Tue, 20 July 2021 07:28]

Report message to a moderator

Previous Topic:Eclipse Scout - HelloScout error
Next Topic:Jersey/Jetty API Handler/Container resends the GET request every 1 min
Goto Forum:
  


Current Time: Tue Apr 16 18:06:00 GMT 2024

Powered by FUDForum. Page generated in 0.99702 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top