如何使用ASP.NET mvc4创建绘图标记工具 [英] How to create drawing markup tools using ASP.NET mvc4

查看:63
本文介绍了如何使用ASP.NET mvc4创建绘图标记工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是asp.net mvc的新手。我正在开发mvc应用程序,我正在使用iframe在网页中打开

pdf文档。在那个pdf文档上我想画刻度线和标记,我想写一些文字可以任何人建议我怎么做请



我有什么试过:



i试过这个java脚本





函数renderPDF(url,canvasContainer,options){

var options = options || {scale:1};



函数renderPage(页面){

var viewport = page.getViewport(options.scale);

var canvas = document.createElement('canvas');

var ctx = canvas.getContext('2d');

var renderContext = {

canvasContext:ctx,

视口:视口

};



canvas .height = viewport.height;

canvas.width = viewport.width;

canvasContainer.appendChild(canvas);



page.render(renderContext);

}



函数renderPages(pdfDoc){

for(var num = 1; num& lt; = pdfDoc.numPages; num ++)

pdfDoc.getPage(num).then(renderPage);

}

PDFJS.disableWorker = true;

PDFJS.getDocument(url).then(renderPages);

}

i am very new to asp.net mvc. i am developing mvc application in that i am opening
pdf document in web page using iframe. on that pdf document i want to draw tick marks and into marks and i wanto write some text can any one suggest me how to do please

What I have tried:

i have tried this java script


function renderPDF(url, canvasContainer, options) {
var options = options || { scale: 1 };

function renderPage(page) {
var viewport = page.getViewport(options.scale);
var canvas = document.createElement('canvas');
var ctx = canvas.getContext('2d');
var renderContext = {
canvasContext: ctx,
viewport: viewport
};

canvas.height = viewport.height;
canvas.width = viewport.width;
canvasContainer.appendChild(canvas);

page.render(renderContext);
}

function renderPages(pdfDoc) {
for (var num = 1; num <= pdfDoc.numPages; num++)
pdfDoc.getPage(num).then(renderPage);
}
PDFJS.disableWorker = true;
PDFJS.getDocument(url).then(renderPages);
}

推荐答案

您无法使用PDF.js编辑PDF在浏览器中。它只呈现PDF来显示它。



您将不得不使用不同的库来编辑PDF的客户端。由于您正在尝试添加编辑功能,因此您使用的库将比PDF.js大得多,并且您最终必须将大量资产交付给客户端以使编辑器启动并运行。 br />


PDFNet.js [ ^ ]可能适合您,但您是唯一能够回答该问题的人。
You can't use PDF.js to edit a PDF in the browser. It only renders a PDF to display it.

You're going to have to use a different library to edit PDF's client-side. Since you're trying to add editing capability, the library you use will be much, much larger than PDF.js and you'll end up have to ship over a ton of assets to the client to get the editor up and running.

Something like PDFNet.js[^] might work for you, but you're the only one who can answer that question.


这篇关于如何使用ASP.NET mvc4创建绘图标记工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆