Html 如何在 Canvas 上加载 Pdf 文件作为 image.src?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17489261/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to load Pdf file on Canvas as a image.src?
提问by fmt.Fprint
I am able to load image on canvas but now I want to replace the Image with pdf file. How to load Pdf file on Canvasas a image.src?
我可以在画布上加载图像,但现在我想用 pdf 文件替换图像。如何在Canvas上加载 Pdf 文件作为 image.src?
回答by mguimard
You can achieve this with pdf.js https://github.com/mozilla/pdf.js/
您可以使用 pdf.js https://github.com/mozilla/pdf.js/实现此目的
Take a look at this article http://www.codediesel.com/javascript/rendering-pdf-in-html5-canvas/
看看这篇文章http://www.codediesel.com/javascript/rendering-pdf-in-html5-canvas/