Skip to content

Releases: donhauser/wagtail-pdf

Wagtail 6 support, ViewSets, previewable models

30 Jan 18:50
Compare
Choose a tag to compare

The new update restores compatibility to wagtail 6.
Plenty of code was reworked to unite ViewSet and PDF-rendering functionallity for models and improvedly adapts the module to the wagtail ecosystem. (Legacy ModelAdmin code is not supported any more.)
The changes bring several enhancements, for example PDF renderable models can now be previewed during creation/editing.

Bugfixes and changes

  • Added missing pdfjs files (pdf.mjs, ...)
  • separated preview functionality from RoutablePageMixin into MultiplePreviewMixin
  • BasePdfViewMixin as renamed to BasePdfMixin
  • BasePdfMixin.get_pdf_view() was reworked, methods like BasePdfMixin.get_pdf_view_kwargs() were added to be more similar to wagtail style methods
  • Parts of PdfViewPageMixin were split off into BasePdfMixin and BasePreviewablePdfMixin
  • PdfModelMixin was created based on BasePdfMixin and wagtail's PreviewableMixin to enable pdf servable models
  • PreviewableViewSetMixin was added for utilizing wagtail's PreviewableMixin
  • Models and Pages now support the specification of separate preview classes through pdf_view, preview_pdf_view, and preview_panel_pdf_view.
  • PdfViewSetMixin and PdfAdminViewSetMixin now replace old ModelAdmin mixins
  • The 'show live' button in PdfViewSetMixin is added to the IndexView if the models URL could be reversed
  • pdf_options dictionaries from different sources are not merged any more
  • register_pdf_view hook was added to easily create viewable PDF models
  • 'wagtail_pdf_view.urls' should now be used to register the modules urls
  • latex code was moved to a separate app wagtail_pdf_view_tex

In Panel Preview Update

09 Oct 12:15
Compare
Choose a tag to compare

To support the in panel previews introduced in wagtail 4.0, this module now employs pdf.js as server hosted PDF viewer.

Support

This version supports wagtail 4 and wagtail 5.

Upgrading from 0.2.1

Check whether wagtail_pdf_view is inside INSTALLED_APPS:

# settings.py

INSTALLED_APPS = [
    ...
    # this is now required!
    'wagtail_pdf_view',
    'wagtail.contrib.routable_page',
    ...
]

It is now required to hook in wagtail_pdf_urls.urls into your projects urls.py:

# urls.py

from wagtail_pdf_view import urls as wagtail_pdf_urls

# this is now required!
urlpatterns = urlpatterns + [
    # hook in the 'live'-view PDFs under "pdf/"
    path("pdf/", include(wagtail_pdf_urls)),
    ...
    # IMPORTANT: This must be below the "pdf/" include
    path("", include(wagtail_urls)),
    ...
]

Bugfixes and changes

  • Fixed the displaying of PDFs inside <iframe>, by hosting the PDF viewer on the server, such that container's properties (like scroll) can be accessed without CORS issues
  • Updated imports to support wagtail 4 and wagtail 5
  • Implemented PDF viewer registry register_pdf_view(), register_pdf_admin_view(), get_pdf_viewer_url() and get_pdf_admin_view to replace DEFAULT_PDF_VIEW_PROVIDER and DEFAULT_PDF_ADMIN_VIEW_PROVIDER
  • Renamed PdfViewPageMixin.PDF_VIEW_PROVIDER to PdfViewPageMixin.pdf_view_class
  • get_preview_name() now just outputs the upper case name (e.g. PDF instead of pdf preview)
  • Added settings WAGTAIL_PDF_VIEW and WAGTAIL_PDF_ADMIN_VIEW to hook in custom view classes
  • Added WAGTAIL_DEFAULT_PDF_OPTIONS and WAGTAIL_PREVIEW_PANEL_PDF_OPTIONS to set global options for weasyprint
  • WAGTAIL_PDF_VIEWER to configure a different pdf viewer (instead of pdf.js) in the panel preview
  • Added PdfViewPageMixin.pdf_options, ModelAdminPdfViewMixin.pdf_options, and ModelAdminPdfAdminViewMixin.pdf_options to set local options for weasyprint
  • Added pdf.js as server hosted PDF viewer
  • Added serve_sameorigin to serve the pdf viewer without CORS problems
  • Added redirect_request_to_pdf_viewer()
  • Added get_pdf_viewer_url()
  • Implemented PdfViewPageMixin.serve_preview_pdf() to handle in panel previews
  • Hook in the server side pdf viewer using PdfViewPageMixin.make_preview_request()
  • Fixed WagtailCoreExtensionLatex._include_block()
  • Added a modified CheckboxSelectMultiple for correct checkbox interaction within PDFs
  • Added some logging if a wrong configuration is detected

Support for latest django-weasyprint

27 Jan 12:43
37b5aa9
Compare
Choose a tag to compare

Support for the latest djangp-weasyprint

Bugfixes:

  • get_css() needs an additional argument, Issue #7
  • Fixed MultipleViewPageMixin crash for url=None
  • ModelAdminPdfAdminViewMixin was missing permission_helper_class

PDF Views for Models

02 Aug 10:29
Compare
Choose a tag to compare

Version 0.2 of wagtail-pdf-view brings support for rendering PDF views of models.

Use-cases include:

  • rendering customer invoices
  • creating participation lists of members in your organization
  • rendering tickets
  • and many more!

Since models do not use wagtails draft system, there are no previews for the model PDFs.
Unlike PDF view pages, PDF rendered models are useful for rather simple content, or for generated content.

This version offers you three different ways to include the rendered PDF models in your page

  • /admin restricted content, managed by ModelAdmin
  • public content, managed by ModelAdmin
  • public content, the view is directly embedded in your urls.py

Version changes:

  • PdfModelMixin implements basic functionalities needed to render a model as PDF
  • New file modeladmin/mixins.py:
    • ModelAdminPdfViewMixin automatically create a public view for the inheriting model (with action 'live')
    • ModelAdminPdfAdminViewMixin automatically create a /admin restricted view for the inheriting model (with action 'pdf')
    • ExtendableButtonHelperMixin allows to append custom buttons to ModelAdmins ButtonHelper easier
    • CustomActionPermissionHelperMixin implements generalized permission check function user_can_perform_action()
  • The new file urls.py loads URLs from the new wagtail hook register_pdf_site_urls
  • AdminViewMixin can be used to require view permissions on a model
  • WagtailTexAdminView and WagtailWeasyAdminView implement the restricted views for tex and Weasyprint
  • The more customized class PDFDetailView extends the inheritance from BaseDetailView in WagtailTexView and WagtailWeasyView
  • HTTP-Content from PdfViewPageMixin.serve_pdf() moved to PDFDetailView

Bugfixes:

  • Reversing URLs is now fixed (MultipleViewPageMixin.__init_subclass__() was extended)

Support for LaTeX Tables

23 May 10:12
66781c3
Compare
Choose a tag to compare

Wagtail (contrib) Tables --> LaTeX Tables is now supported in version 0.1.3
Credits go to @eeintech

Bugfixes for LaTex and RichtextFields

18 May 09:41
Compare
Choose a tag to compare

Minor changes in the code to fix the following

  • Bugfix to make RichtextField usable in LaTeX mode.
  • Small changes in SimpleHtmlToLatexParser to fix whitespace problems when using <i> and <b>

0.1.1

22 Jan 16:46
Compare
Choose a tag to compare

Added Jinja2 Latex environment for Wagtail.
Wagtails richtext is automatically translated to latex. This is done with SimpleHtmlToLatexParser which covers basic conversion of html tags.

Initial project release

22 Jan 13:43
Compare
Choose a tag to compare

This version essentially consists of:

  • PdfViewPageMixin for Wagtail pages, configurable with ROUTE_CONFIG and many other options such as stylesheets and attachment.
  • The routing is implemented as MultipleViewPageMixin, a very general extension of wagtails routablepage which supports inheritance.
  • A basic PdfModelMixin for regular django models (to make the PDF rendering process for them as similar as possible)
  • Support for django-weasyprint and django-tex