简体   繁体   English

使用javascript或C#在PDF上绘制

[英]Draw on PDF with javascript or C#

I am looking for a way for a user to go to a webpage on there tablet, smart phone, or pc and view a pdf and then sign it with a pen tool. 我正在寻找一种让用户访问平板电脑,智能手机或PC上的网页并查看pdf,然后使用钢笔工具签名的方法。 Then I need to be able to save it. 然后,我需要能够保存它。 I want them to be able to draw anywhere on the document, not just certain locations. 我希望他们能够在文档的任何地方绘制,而不仅仅是某些位置。 The PDF will vary in page length so I don't believe converting them to an image and back is an option(I could be wrong). PDF的页面长度会有所不同,所以我不认为将它们转换为图像再返回是一种选择(我可能错了)。

I am willing to use a third party tool even if cost something. 我愿意使用第三方工具,即使花费很多。 Any help would be much appreciated. 任何帮助将非常感激。 Thanks. 谢谢。

try iTextSharp . 尝试iTextSharp its free as long as you don't use it commercially. 它是免费的,只要您不将其用于商业用途。 It is a library for making pdf in c# 这是一个用C#制作pdf的库

If I got your requirements right, you need to add free hand drawings to a PDF file from a website. 如果我的要求正确无误,则需要从网站向PDF文件添加免费的手绘图。 You can do this by: 您可以通过以下方式做到这一点:
1- Generating a raster image from your PDF file and displaying it on a webpage. 1-从PDF文件生成光栅图像,并将其显示在网页上。
2- Allowing free-hand drawings on your page and collecting the collection of connected points that result from the drawing. 2-在页面上允许徒手绘制图形,并收集图形所产生的连接点的集合。
3- Submitting the points to the server that contains the PDF file, opening the file with a PDF processing library, and adding a PDF annotation to it using the information you got from the browser. 3-将点提交到包含PDF文件的服务器,使用PDF处理库打开该文件,并使用从浏览器获得的信息向其中添加PDF批注。

You can do the step 1 with ghostscript (GPL),or with ImageMagick as a wrapper for ghostscript (GPL), or with a commercial library like Amyuni PDF Creator ( usual disclaimer applies ). 您可以使用ghostscript (GPL)或ImageMagick作为ghostscript的包装(GPL)或使用Amyuni PDF Creator等商业库( 通常适用免责声明 )来执行步骤1。

You can do the step 2 with an HTML5 canvas using Javascript 您可以使用Javascript对HTML5画布执行步骤2

You can do the step 3 with almost every PDF processing library, for example with iTextSharp (AGPL) or again with Amyuni PDF Creator. 您几乎可以对每个PDF处理库执行步骤3,例如,使用iTextSharp(AGPL)或再次使用Amyuni PDF Creator。

Please not that you are not supposed to use GPL libraries in commercial closed-source application without paying anything. 请不要在不支付任何费用的情况下不应在商业封闭源应用程序中使用GPL库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM