mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-11-03 03:16:10 -06:00 
			
		
		
		
	add option for inline vs. attachment for document rendering
This commit is contained in:
		@@ -117,6 +117,10 @@ PAPERLESS_EMAIL_SECRET=""
 | 
				
			|||||||
# http://paperless.readthedocs.org/en/latest/consumption.html#hooking-into-the-consumption-process
 | 
					# http://paperless.readthedocs.org/en/latest/consumption.html#hooking-into-the-consumption-process
 | 
				
			||||||
#PAPERLESS_POST_CONSUME_SCRIPT="/path/to/an/arbitrary/script.sh"
 | 
					#PAPERLESS_POST_CONSUME_SCRIPT="/path/to/an/arbitrary/script.sh"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# By default, when clicking on a document within the web interface, the
 | 
				
			||||||
 | 
					# browser will prompt the user to save the document to disk. By uncommenting
 | 
				
			||||||
 | 
					# the below, the document will instead be opened in the browser, if possible.
 | 
				
			||||||
 | 
					#PAPERLESS_INLINE_DOC="true"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# The following values use sensible defaults for modern systems, but if you're
 | 
					# The following values use sensible defaults for modern systems, but if you're
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,8 @@
 | 
				
			|||||||
from django.http import HttpResponse, HttpResponseBadRequest
 | 
					from django.http import HttpResponse, HttpResponseBadRequest
 | 
				
			||||||
from django.views.generic import DetailView, FormView, TemplateView
 | 
					from django.views.generic import DetailView, FormView, TemplateView
 | 
				
			||||||
from django_filters.rest_framework import DjangoFilterBackend
 | 
					from django_filters.rest_framework import DjangoFilterBackend
 | 
				
			||||||
 | 
					from django.conf import settings
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from paperless.db import GnuPG
 | 
					from paperless.db import GnuPG
 | 
				
			||||||
from paperless.mixins import SessionOrBasicAuthMixin
 | 
					from paperless.mixins import SessionOrBasicAuthMixin
 | 
				
			||||||
from paperless.views import StandardPagination
 | 
					from paperless.views import StandardPagination
 | 
				
			||||||
@@ -60,8 +62,12 @@ class FetchView(SessionOrBasicAuthMixin, DetailView):
 | 
				
			|||||||
            self._get_raw_data(self.object.source_file),
 | 
					            self._get_raw_data(self.object.source_file),
 | 
				
			||||||
            content_type=content_types[self.object.file_type]
 | 
					            content_type=content_types[self.object.file_type]
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
        response["Content-Disposition"] = 'attachment; filename="{}"'.format(
 | 
					
 | 
				
			||||||
            self.object.file_name)
 | 
					        print("OPEN_DOCUMENT", settings.INLINE_DOC)
 | 
				
			||||||
 | 
					        DISPOSITION = 'inline' if settings.INLINE_DOC else 'attachment'
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        response["Content-Disposition"] = '{}; filename="{}"'.format(
 | 
				
			||||||
 | 
					            DISPOSITION, self.object.file_name)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return response
 | 
					        return response
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user