您现在的位置是:首页 >技术教程 >如何搭建PDF文档流服务器网站首页技术教程
如何搭建PDF文档流服务器
前言
自己制作的电子书,不想让别人随意下载,于是考虑采用流式服务,边看边下。考察了一下网上的解决方案,整理出来。
PDF.js
PDF.js supports some features to deal with long documents with many pages. For example, it supports document streaming via byte range requests. This enables documents previously optimized for fast web view to display for the user almost instantly when served via a URL – without having to wait on the entire file to download first.
PDFTron’s
You can load the PDF document stream in PDF Viewer from server-side using the Load() API in the WebAPI controller. Refer to the following code.
C#
FileStream stream = new FileStream(HttpContext.Current.Server.MapPath(“~/Data/F# Succinctly.pdf”), FileMode.Open);
helper.Load(stream);
Copy
The following are the list of Load() APIs available in the PDF Viewer Web platform:
Load(byte[] byteArray)
Load(Stream stream)
Load(string filePath)
Load(Syncfusion.Pdf.Parsing.PdfLoadedDocument lodedDocument)
Load(byte[] byteArray, string password)
Load(Stream stream, string password)
Load(string filePath, string password)
参考文档
- streaming-a-pdf-from-the-web
- https://community.safe.com/s/article/using-the-data-streaming-service-to-stream-pdf
- https://www.cnblogs.com/zwbsoft/p/13280672.html
- https://github.com/citeccyr/pdf-stream
- 商业例子: https://showcase.apryse.com