NetTalk Central

Author Topic: is it possible to display a PDF in a browse?  (Read 3126 times)

dcpeders

  • Newbie
  • *
  • Posts: 32
    • View Profile
    • Email
is it possible to display a PDF in a browse?
« on: November 03, 2011, 08:06:43 AM »
Hi,

I have a NetWebBrowse showing photo images and it works great. It shows 3 photos across.

I am also saving some pdf forms that I need to show in the Browse also.

How would I also display a PDF image along with the photos? Is this even possible?

Thanks,

Dave Pederson

kevin plummer

  • Hero Member
  • *****
  • Posts: 1195
    • View Profile
    • Production Accounting and Software Payroll
Re: is it possible to display a PDF in a browse?
« Reply #1 on: November 03, 2011, 02:33:37 PM »
you probably need to convert them to an image first.

Stu

  • Hero Member
  • *****
  • Posts: 510
    • View Profile
    • Email
Re: is it possible to display a PDF in a browse?
« Reply #2 on: November 03, 2011, 08:03:46 PM »
Dave,

Aye, it's possible. Can't speak to the wisdom of doing so though :)

Check out jQuery Media plugin (http://jquery.malsup.com/media/) which allows you to put a "div" on a page somewhere with _something_ in it.

Example code:

Code: [Select]
packet = clip(packet)&|
  '<div id="your-pdf" class="your-pdf">'&|
    '<button>Show/Hide latest PDF</button>'&|
    '<a class="pdf-file" href="http://'&clip(SITEURL)&'/'&clip(PDF RELATIVE PATH)&'"></a>'&|
  '</div>'&|
  '<script>'&|
    '$(".pdf-file").media({{width: 500, height: 800});'&|
    '$("button").click(function() {{ $(".pdf-file").slideToggle("slow"); });'&|
    '$(document).ready(function() {{ $(".pdf-file").hide(); });'&|
  '</script>'

This was written over 12 months ago. Probably needs <13,10>'s for readability. Not sure how many version of the media plugin since then. But it works with what I've got.
Cheers,

Stu Andrews