Hi Daniel,

>From my point of view, it is one of the strength of Tapestry not to abstract 
>the web away. A proper understanding of web technologies is the foundation to 
>build robust, fast and maintainable applications.
I've seen entire teams struggling with all sorts of issues just because they 
used such "magic frameworks" without fully understand the underlying 
technologies (JSF component libraries are just one example).

Concerning PDF: the easiest thing you could probably do is to render the PDF in 
the browser using JS (pdf.js works with all recent major browsers). There are 
also PDF rendering engines for Java, so you could use Applets (beware) or 
convert the PDF into an image (SVG for example).

Best,
Thilo

________________________________________
From: Poggenpohl, Daniel <daniel.poggenp...@isst.fraunhofer.de>
Sent: Thursday, February 19, 2015 22:12
To: Tapestry users
Subject: AW: AW: PDF Viewer component

Hello,

it seems that somehow I believed Tapestry would be more magical than it is. 
Yeah, after reading your answers, it sure is stupid to believe that some web 
page can magically embed and render some pdf as part of a page.

So, going back to my intent, I want to display a pdf as part of a page. This 
can be done using an iframe and a StreamResponse. I've tried just embedding 
another tapestry page in that iframe and making onActivate or onPAGE_NAME 
return the StreamResponse, but that just made the container page render the PDF 
completely, ignoring all other content.

Some information that is obviously required when answering my question is which 
browsers do I want to support with the application: First and foremost Firefox, 
then maybe Chrome and last but not least possibly IE. That is the extent to 
which I thought about this. No version ranges.

So, I know that Firefox renders application/pdf using the pdf.js "module", 
which seems to display a pdf as a complete page.

I also know of "ViewerJS", which should be able to embed my pdf in another 
page, also using an iframe. Does anybody know if this is usable with above 
browsers?

Are there any other alternatives for embedding PDF documents in pages? What 
about HTML5 <embed>?

Regards,
Daniel P.

P.S.: This seems to be not that much Tapestry-specific anymore...any 
Tapestry-using methods?

________________________________________
Von: Thiago H de Paula Figueiredo [thiag...@gmail.com]
Gesendet: Donnerstag, 19. Februar 2015 17:18
An: Tapestry users
Betreff: Re: AW: PDF Viewer component

On Thu, 19 Feb 2015 12:28:02 -0200, Poggenpohl, Daniel
<daniel.poggenp...@isst.fraunhofer.de> wrote:

> Hello,

Hi!

> well, embedding the component in a page shows not the PDF but the Java
> object identity, e.g.
> InlineViewingStreamResponse@8173c6
>
> Maybe the error is somewhere else?
> My component template is basically only ${showDocument()}.

${} always works by outputting the result of calling toString() in the
object returned by the expression inside it.

You're trying to embed binary content (PDF) inside a web page directly.
This will never work.

> Re: iframe - If I use an iframe for embedding a document viewer page,
> how do I set the "src" parameter? I haven't found a more elegant way
> than src="go\back\to\the\folder\containing\the\viewer".

You cannot make the src attribute of <iframe> point to a folder. The src
value is supposed to be the URL of the content to be shown there.

The viewer itself, if you're not letting the browser render the PDF itself
through some browser plugin like Adobe Reader's one, will be some kind of
JavaScript code which will take the URL of the PDF file to be viewed as a
parameter.

--
Thiago H. de Paula Figueiredo
Tapestry, Java and Hibernate consultant and developer
http://machina.com.br

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org

Reply via email to