如何在 Django-CKEditor 中上传 PDF?

问题描述

我正在尝试在 CKEditor 中为 Django 上传 PDF 文件。这是我在 settings.py 中的设置:

CKEDITOR_CONfigS = {
'default': {
    'removePlugins': 'stylesheetparser',# Toolbar configuration
    # name - Toolbar name
    # items - The buttons enabled in the toolbar
    'toolbar_DefaultToolbarConfig': [
        {
            'name': 'basicstyles','items': ['Bold','Italic','Underline','Strike','Subscript','Superscript',"BGColor"],},{
            'name': 'clipboard','items': ['Undo','Redo',],{
            'name': 'paragraph','items': ['NumberedList','BulletedList','Outdent','Indent','HorizontalRule','JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock',{
            'name': 'format','items': ['Format',{
            'name': 'extra','items': ['Link','Unlink','Blockquote','Image','Update','Table','CodeSnippet','Mathjax','Embed',{
            'name': 'source','items': ['Maximize','Source',# This hides the default title provided by CKEditor
    'title': False,# Use this toolbar
    'toolbar': 'DefaultToolbarConfig',# Which tags to allow in format tab
    'format_tags': 'p;h1;h2',# Remove these dialog tabs (semicolon separated dialog:tab)
    'removeDialogTabs': ';'.join([
        'image:advanced','image:Link','link:upload','table:advanced','tableProperties:advanced',]),'linkShowTargetTab': False,'linkShowAdvancedTab': False,# CKEditor height and width settings
    'height': '250px','width': 'auto','forcePasteAsPlainText ': True,# Class used inside span to render mathematical formulae using latex
    'mathJaxClass': 'mathjax-latex',# Mathjax library link to be used to render mathematical formulae
    'mathJaxLib': 'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS_SVG',# Tab = 4 spaces inside the editor
    'tabSpaces': 4,# Extra plugins to be used in the editor
    'extraPlugins': ','.join([
        'uploadimage',# 'devtools',# Shows a tooltip in dialog Boxes for developers
        'mathjax',# Used to render mathematical formulae
        'codesnippet',# Used to add code snippets
        'image2',# Loads new and better image dialog
        'embed',# Used for embedding media (YouTube/Slideshare etc)
        'tableresize',# Used to allow resizing of columns in tables
        #'Syntaxhighlight',}

当我尝试上传 PDF 文件时,它们只显示为空白。我需要在我的设置中添加什么?有没有办法使用 CKEditor for Django 上传 PDF?我需要使用不同的文本编辑库来实现吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)