相关疑难解决方法(0)

将画布转换为PDF

是否可以使用JavaScript(pdf.js或类似的东西)直接将canvas转换为pdf ?

是否有另一种可能的方式,如canvas到img然后img到pdf?

能给我举个例子?

javascript pdf-generation canvas

34
推荐指数
3
解决办法
9万
查看次数

是否可以使用 StreamingHttpResponse 生成 PDF,因为可以使用 CSV 生成大型数据集?

我有一个大型数据集,我必须为其生成 CSV 和 PDF。对于 CSV,我使用本指南:https : //docs.djangoproject.com/en/3.1/howto/outputting-csv/

import csv

from django.http import StreamingHttpResponse

class Echo:
    """An object that implements just the write method of the file-like
    interface.
    """
    def write(self, value):
        """Write the value by returning it, instead of storing in a buffer."""
        return value

def some_streaming_csv_view(request):
    """A view that streams a large CSV file."""
    # Generate a sequence of rows. The range is based on the maximum number of
    # rows that can be handled by a single …
Run Code Online (Sandbox Code Playgroud)

python django large-data streaminghttpresponse

13
推荐指数
1
解决办法
476
查看次数

有没有办法在pdf.js中组合PDF?

好吧,我想使用pdf.js将html5中的现有pdf文件合并,并从中生成单个pdf

这可能,我该怎么做?

javascript pdf html5 pdf.js

9
推荐指数
1
解决办法
1万
查看次数

如何打印base64 pdf?

我从要打印的服务器上收到了base64 pdf。

我一直在尝试以下方法:

$.ajax({
    type: "POST",
    url: url,
    data: blahblahblah,
    success: function(data) {
        var printWindow = window.open( "data:application/pdf;base64, " + data );
        printWindow.print();
    }
});
Run Code Online (Sandbox Code Playgroud)

遗憾的是,这在Chrome中不起作用。我收到以下错误:

SecurityError:阻止源为“ xxx”的帧访问源为“ null”的帧。请求访问的帧的协议为“ http”,正在访问的帧的协议为“数据”。协议必须匹配。

有关如何解决此问题的建议?

javascript pdf jquery

2
推荐指数
2
解决办法
8701
查看次数