Results 1 to 2 of 2

Thread: How to open PDF in a new browser tab

  1. #1
    ewpeanutty is offline Sugar Community Member
    Join Date
    Jun 2011
    Posts
    109

    Default How to open PDF in a new browser tab

    Greetings,

    I have been working on integrating a jasper report server with my instance of Sugar CE 6.5.16-- I've got most of the big pieces working. I am using the SOAP approach with DIME attachments to upload jrxml files to the server and then run the report and receive back a pdf. I can even email the pdf to the user... but I would like to be able to display the pdf in a new tab in the browser...

    Generally speaking, I've read that javascript is the way to open a pdf in a new tab -- but I wanted to confer with you all and make sure that I'm on the right track and that js is the way to go with this. Or if Sugar has a lovely little function somewhere that I can use to accomplish this task?

    Thanks for any tips or advice on this matter!

    -el

  2. #2
    mminnie's Avatar
    mminnie is offline Sugar Community Member
    Join Date
    May 2005
    Location
    Sacramento, CA
    Posts
    97

    Default Re: How to open PDF in a new browser tab

    You will have to use javascript to open up a new tab. The new tab will be a call to a custom entry point to your SugarCRM instance. This entry point will be something like:
    PHP Code:
    <?php

    if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

    $pdfdata someFunctionToGetPDFDataInAString($_REQUEST['someRequestParameter']);
    header("Content-type: application/pdf");
    header("Content-disposition: inline;filename=someFileNameToGiveBrowser.pdf");
    echo 
    $pdfdata;

    You can't force the browser to open a PDF file, but most browsers will open up the PDF. The settings on the browser might be set to download the PDF.


    If I'm stubborn enough, I just might figure it out myself.
    SugarCRM Version 6.5.9 (Build 8653)
    System: Linux 3.2.0-32-generic Ubuntu 12.04 LTS
    PHP Version 5.3.10-1ubuntu3.4
    MySQL Version 5.5.24

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 0
    Last Post: 2013-06-02, 01:24 PM
  2. Open New Browser Window/Pass Data?
    By SSAgov in forum Developer Help
    Replies: 0
    Last Post: 2011-01-21, 12:18 PM
  3. Replies: 5
    Last Post: 2008-05-06, 02:58 AM
  4. Replies: 5
    Last Post: 2006-02-01, 06:40 PM
  5. Browser No Toolbar
    By MidNiteRaver in forum Help
    Replies: 3
    Last Post: 2005-08-12, 06:30 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •