Hãy thử Google'ing pdf.js documentation
/* create the PDF document */
var doc = new pdf();
doc.text(20, 20, 'hello, I am PDF.');
doc.text(20, 30, 'i was created in the browser using javascript.');
doc.text(20, 40, 'i can also be created from node.js');
/* Optional - set properties on the document */
doc.setProperties({
title: 'A sample document created by pdf.js',
subject: 'PDFs are kinda cool, i guess',
author: 'Marak Squires',
keywords: 'pdf.js, javascript, Marak, Marak Squires',
creator: 'pdf.js'
});
doc.addPage();
doc.setFontSize(22);
doc.text(20, 20, 'This is a title');
doc.setFontSize(16);
doc.text(20, 30, 'This is some normal sized text underneath.');
var fileName = "testFile"+new Date().getSeconds()+".pdf";
var pdfAsDataURI = doc.output('datauri', {"fileName":fileName});
LƯU Ý: các "pdf.js" dự án đề cập ở đây là https://github.com/Marak/pdf.js, và đã bị phản đối bởi vì câu trả lời này đã được đăng. Câu trả lời của @ Treffynnon là về dự án Mozilla vẫn còn hoạt động (https://github.com/mozilla/pdf.js) mà hầu hết người tìm kiếm sẽ tìm kiếm.
Nguồn
2012-02-17 12:54:59
### Github Điều tôi chỉ mới bắt đầu một bài báo [PDF.js cài đặt trong một trang web] (https://github.com/mozilla/pdf.js/wiki/Setup-PDF .js-in-a-website) trên wiki dự án trên GitHub. ### Yêu cầu hoàn thành Nếu bạn có một số kinh nghiệm, vui lòng hoàn thành bài viết. –
Tôi đang tìm kiếm điều tương tự. Tôi thấy đây là bước đi chi tiết nhất để thiết lập pdf.js, bắt đầu kết thúc. Chúc may mắn! http://www.worldwidewhat.net/2011/08/render-pdf-files-with-html5/ – Raj
Thứ gì đó cao cấp hơn như http://viewerjs.org/ có lẽ là những gì bạn muốn. – max