fancybox show pdf

manue picture manue · Nov 8, 2012 · Viewed 34.9k times · Source

hi i am trying to display a PDF with fancybox but I can not.

I have this code:

 $(".fancybox").fancybox({
      'frameWidth': 100,
       'frameHeight':495,
       'overlayShow':true,
       'hideOnContentClick':false,
      'type':'iframe'
})

and

<a class="fancybox" href="/symfony2/web/app.php/pdf/2"> show pdf</a>

but shows me that way generated pdf:

http://www.subirimagenes.com/imagen-pantallazo-8110661.html

Does anyone know how to solve the problem to display the facybox correctly? a greeting.

Answer

Janis picture Janis · Nov 8, 2012

Could you explain what exatly does not work for you? It should work - http://jsfiddle.net/zqJFp/

<a class="fancybox" href="http://samplepdf.com/sample.pdf">Open pdf</a>

​$(".fancybox").fancybox({
    width  : 600,
    height : 300,
    type   :'iframe'
});​