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 [[email protected]]
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
<[email protected]> 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: [email protected]
For additional commands, e-mail: [email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to