Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: View documents in browser

  1. #1
    bafplus is offline Senior Member
    Join Date
    Jul 2010
    Location
    Oosterhout
    Posts
    36

    Thumbs up SOLVED: View documents in browser

    SOLVED: see post #13

    I would be great to have an option to "preview" documents.
    At this point i have hundreds of pdf files in my document module.
    In the end of the day working in Sugar, al documents that i have viewed today all are downloaded to the local machine.
    It would be great to view the pdf files within sugar and download them only whem i need the document for further use.

    Using google docs or equivelent is no option since my workstation is not connected to the internet so i realy need something that works directly in my browser.

    Using:

    Sugar CE 5.4
    Platform Linux (ubuntu)
    Browser Chrome/Firefox
    Last edited by bafplus; 2011-03-20 at 07:50 AM. Reason: Marking thread solved

  2. #2
    Neil_Weston is offline Member
    Join Date
    Mar 2011
    Posts
    9

    Default Re: View documents in browser

    I fully support this as a feature request and find it frustrating that such a simple feature is not available

  3. #3
    eggsurplus's Avatar
    eggsurplus is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Minnesota
    Posts
    2,343

    Default Re: View documents in browser

    It may be simple to use but not so sure it would be simple to implement. Also not sure what the added value really is with implementing this feature request. It would seem that the same amount of data would need to still be sent to the browser as just downloading and viewing the file.

  4. #4
    bafplus is offline Senior Member
    Join Date
    Jul 2010
    Location
    Oosterhout
    Posts
    36

    Default Re: View documents in browser

    I agree about the datatransfer.

    The datatransfer is not the problem, but where it stores that data is.
    Now its simply downloaded to the downloadfolder.
    It would be great to have an option to first view the item (download and store in Temp folder and) and another option to download it to the downloadfolder for further use.

    The problem lies in WHERE it stores the data just for viewing.

    And i believe that if you have a view option that it only renders the PDF as if it was an (say .jpeg) image, so the browser only displays it but it doesn't stores the file localy.

    Take for example, google docs, if you have an pdf as atachment, you can view it in the browser, and if you want you can download it to you're PC.
    Implementing the google docs API is also an option.

    A good example: http://blogs.adobe.com/pdfdevjunkie/...tag_to_di.html
    A way would be that there is an extra tab available in the filedetails dat would display the file using the code.
    As extra you could have a button to view fullsize that opens a popup to view the file fullscreen.
    Then a downloadbutton gives the viewer the option to download the file to his machine.
    Last edited by bafplus; 2011-03-16 at 08:05 AM.

  5. #5
    item is offline Sugar Community Member
    Join Date
    Oct 2010
    Location
    BELGIUM
    Posts
    193

    Default Re: View documents in browser

    Hello,

    +1, i agree to this feature.

    kind regards
    CE 6.2.4
    Osx Server 10.5.8
    Apache - MySql - Php built-in
    sorry for my good english

  6. #6
    Neil_Weston is offline Member
    Join Date
    Mar 2011
    Posts
    9

    Default Re: View documents in browser

    I think that the problem is that Sugar stores the documents in its database. - Which I suppose is fair enough for a database structured system.

    But in clicking on the link to the document the browser gets all the associated php code of "?module=Documents&offset=6&stamp=1300, etc, etc, etc." not just the direct link to the document itself.

    The browser therefore does not seem to get the information it requires to know what type of document it is in order open it, so it does the next best thing and downloads it.

    However, if I have a link on a web page directly to a document such as href="http://www.my-site.com/brochures/my-brochure.pdf" target="_blank" the document will open in the browser and give me the opportunity to either just view it, print it or save it to disk.

    It would therefore seem to be of some benefit if Sugar was able to retrieve the document from the database without appending all the php code to the file link and just provide the browser with a clean path to the document itself.

  7. #7
    item is offline Sugar Community Member
    Join Date
    Oct 2010
    Location
    BELGIUM
    Posts
    193

    Default Re: View documents in browser

    Quote Originally Posted by Neil_Weston View Post
    I think that the problem is that Sugar stores the documents in its database. - Which I suppose is fair enough for a database structured system.....
    Hi Nell,
    For me (CE 61) sugar store all document under a directory in /root/cache/upload/.....
    also sugar have a table who store all information about these documents :
    - document_id (file name under /cache/upload directory)
    - filename
    - file extention
    - file mime type

    Then it must not be difficult for a sugar hero to create a custom code to build the link with a "doc viewer".

    Regards
    CE 6.2.4
    Osx Server 10.5.8
    Apache - MySql - Php built-in
    sorry for my good english

  8. #8
    Neil_Weston is offline Member
    Join Date
    Mar 2011
    Posts
    9

    Default Re: View documents in browser

    Didn't realise that they were just loaded into that directory, but as you say the name is totally changed to a long reference id number with no applicable file extension.

    Even when the name change is made if it retained the same extension and MIME type even a renamed document called something like 4ad43297-5b69-064c-dd21-4d7f03ca41be.pdf should still open in the Browser.

    I wonder if all the documents are the same type if it would be a simple matter of doing a little trick with an .htaccess file using the Apache DefaultType instruction to have the Browser understand how to treat it?

  9. #9
    Neil_Weston is offline Member
    Join Date
    Mar 2011
    Posts
    9

    Default Re: View documents in browser

    Just tested my theory as above.

    I ONLY have .pdf documents in my cache/upload directory.

    I put an .htaccess file that contained the single line;

    DefaultType application/pdf

    into that directory.

    Opened Sugar in my Web Browser and went to the Documents tab

    Went to the Document Overview screen for a particular document and clicked on the file link next to File Name:

    I have a Mac running OSX 10.6.6 and using Safari as my Browser.

    The file immediately opened in Preview. Which was a step forward because I previously had to open it from within my downloads folder.

    BUT the Browser still downloaded it into the downloads folder first which is what I am trying to avoid.

    Also tried the line DefaultType None/pdf in my htaccess file but that did not make any difference.

    So as yet, no simple fix

  10. #10
    bafplus is offline Senior Member
    Join Date
    Jul 2010
    Location
    Oosterhout
    Posts
    36

    Default Re: View documents in browser

    I will test you're htaccess trick on my site on a windows with IE, chrome and opera.

    I put the htacces in the cache/upload directory.

    It did nothing here.
    It just downloads the document as usual in al 3 browsers.

    I noticed something else,
    The document as is stored in the upload dir is not a standard pdf!.
    Even if you manualy add the .pdf extension the pdf can not be read bij acrobat.
    That maybe is the whole difficulty in implementing the code.

    It should first "convert" the pdf the same way as it does when you hit the downloadlink but instead of downloading it should put it in, say, the temp folder on the server.
    After that the code as mentioned can be used to view this direct link to the document on the server.

    After that, it should run a script that purges the temp folder to delete the temp pdf file after some time.
    Last edited by bafplus; 2011-03-17 at 11:47 AM.

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Can not download or View Documents
    By bangde in forum Help
    Replies: 1
    Last Post: 2010-01-29, 05:25 AM
  2. Replies: 1
    Last Post: 2009-09-16, 11:25 AM
  3. browser view source
    By sirajbg in forum Developer Help
    Replies: 3
    Last Post: 2007-01-12, 01:23 AM
  4. Replies: 1
    Last Post: 2006-02-04, 09:42 AM
  5. View all documents by date last modified
    By csytsma in forum Feature Requests
    Replies: 3
    Last Post: 2004-11-03, 11:05 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
  •