mirror of
				https://github.com/paperless-ngx/paperless-ngx.git
				synced 2025-10-30 03:56:23 -05:00 
			
		
		
		
	Merge pull request #597 from bauerj/pdf-preview
Add PDF preview next to edit form
This commit is contained in:
		| @@ -3,6 +3,10 @@ | ||||
| {% block content %} | ||||
|  | ||||
| {{ block.super }} | ||||
| <div class="side-preview"> | ||||
|   <h2>Preview</h2> | ||||
|   <object data="/fetch/preview/{{object_id}}"></object> | ||||
| </div> | ||||
|  | ||||
| {% if next_object %} | ||||
| 	<script type="text/javascript">//<![CDATA[ | ||||
| @@ -17,6 +21,37 @@ | ||||
|  | ||||
| {% endblock content %} | ||||
|  | ||||
| {% block extrastyle %} | ||||
| {{ block.super }} | ||||
| <style> | ||||
| .side-preview { | ||||
|     width: 100%; | ||||
|     height: 800px; | ||||
|     clear: both; | ||||
| } | ||||
|  | ||||
| .side-preview object { | ||||
|     height: 100%; | ||||
|     width: 100%; | ||||
| } | ||||
|  | ||||
| @media screen and (min-width: 1500px) { | ||||
|     #content-main { | ||||
|         width: 50%; | ||||
|     } | ||||
|     #footer { | ||||
|         padding: 0; | ||||
|     } | ||||
|     .side-preview { | ||||
|         float: right; | ||||
|         width: 40%; | ||||
|         height: 80vh; | ||||
|         clear: none; | ||||
|     } | ||||
| } | ||||
| </style> | ||||
| {% endblock %} | ||||
|  | ||||
| {% block footer %} | ||||
|  | ||||
| 	{{ block.super }} | ||||
|   | ||||
| @@ -69,7 +69,10 @@ class FetchView(SessionOrBasicAuthMixin, DetailView): | ||||
|             content_type=content_types[self.object.file_type] | ||||
|         ) | ||||
|  | ||||
|         DISPOSITION = 'inline' if settings.INLINE_DOC else 'attachment' | ||||
|         DISPOSITION = ( | ||||
|             'inline' if settings.INLINE_DOC or self.kwargs["kind"] == 'preview' | ||||
|             else 'attachment' | ||||
|         ) | ||||
|  | ||||
|         response["Content-Disposition"] = '{}; filename="{}"'.format( | ||||
|             DISPOSITION, self.object.file_name) | ||||
|   | ||||
| @@ -37,7 +37,7 @@ urlpatterns = [ | ||||
|  | ||||
|     # File downloads | ||||
|     url( | ||||
|         r"^fetch/(?P<kind>doc|thumb)/(?P<pk>\d+)$", | ||||
|         r"^fetch/(?P<kind>doc|thumb|preview)/(?P<pk>\d+)$", | ||||
|         FetchView.as_view(), | ||||
|         name="fetch" | ||||
|     ), | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 David Martin
					David Martin