Skip to main content



      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 06:03 Go to next message
Eclipse UserFriend
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 06:42 Go to previous messageGo to next message
Eclipse UserFriend
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.

Re: Viewing/rendering PDF file [message #1806031 is a reply to message #1806005] Wed, 01 May 2019 01:47 Go to previous messageGo to next message
Eclipse UserFriend
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 10:31 Go to previous messageGo to next message
Eclipse UserFriend
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 16:09 Go to previous messageGo to next message
Eclipse UserFriend
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 07:11 Go to previous messageGo to next message
Eclipse UserFriend
Thanks it is working perfectly
Re: Viewing/rendering PDF file [message #1842954 is a reply to message #1827669] Wed, 07 July 2021 12:52 Go to previous messageGo to next message
Eclipse UserFriend
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 10:32] by Moderator

Re: Viewing/rendering PDF file [message #1843203 is a reply to message #1842954] Tue, 20 July 2021 02:41 Go to previous message
Eclipse UserFriend
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é

[Updated on: Tue, 20 July 2021 03:28] by 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: Sun Jul 06 15:11:25 EDT 2025

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

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

Back to the top