我已被指控为我的公司在完成特定培训课程时向客户打印的证书的功能工作。目前,我们为他们提供了一个基本的PDF文件,看起来像一般的Joe奖,但我们的许多客户希望能够在实际的PDF上添加和重新定位内容并打印出来。我开始使用一种名为PDFSharp的开源C#代码解决方案,并发现它有很多很棒的功能,但我不确定如何制作新放置的项目(比如说用户导入了自己的证书功能区或密封图形) 。有什么C#功能我应该看看或任何第三方软件,将为我做这一切?在PDF文档上移动项目
我对任何一条路线都开放。
在此先感谢!
我已被指控为我的公司在完成特定培训课程时向客户打印的证书的功能工作。目前,我们为他们提供了一个基本的PDF文件,看起来像一般的Joe奖,但我们的许多客户希望能够在实际的PDF上添加和重新定位内容并打印出来。我开始使用一种名为PDFSharp的开源C#代码解决方案,并发现它有很多很棒的功能,但我不确定如何制作新放置的项目(比如说用户导入了自己的证书功能区或密封图形) 。有什么C#功能我应该看看或任何第三方软件,将为我做这一切?在PDF文档上移动项目
我对任何一条路线都开放。
在此先感谢!
我使用Itext
的代码是Boo,打开“template.pdf”,并绘制一个矩形,并写上“世界你好”,然后创建一个新的PDF文件并打开它
import iTextSharp.text
import iTextSharp.text.pdf
import iTextSharp.text.Color
import System.IO
import iTextSharp.text
import System.Diagnostics
# we create a reader for a certain document
reader = PdfReader("template.pdf")
# we retrieve the size of the first page
psize = reader.GetPageSize(1);
# step 1: creation of a document-object
Document.Compress = true
documentGlobal = Document(psize, 50, 50, 50, 50)
# step 2: we create a writer that listens to the document
thePdfFile = MemoryStream()
writer = PdfWriter.GetInstance(documentGlobal, thePdfFile)
documentGlobal.Open()
cbLocal = writer.DirectContent
page1 = writer.GetImportedPage(reader, 1)
cbLocal.AddTemplate(page1, 1f, 0, 0, 1f, 0, 0)
#Drawing a rectangle
rec = Rectangle(100, 100, 150, 150)
rec.BackgroundColor = iTextSharp.text.Color(0,0,0)
cbLocal.Rectangle(rec);
#Writing some text
#There are many ways to write text, check the examples
bf = BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.EMBEDDED)
font = Font(bf, 10, 0)
font.SetColor(0, 0, 0)
ColumnText.ShowTextAligned(cbLocal, 0, Phrase("Hello World", font), 50, 50, 0)
documentGlobal.Close()
tempFile = Path.GetTempFileName();
ms = MemoryStream(thePdfFile.ToArray());
stream = FileStream(tempFile + ".pdf", FileMode.Create);
ms.WriteTo(stream);
ms.Close();
stream.Close();
Process.Start(tempFile + ".pdf");
编辑
OOP,看来我不明白的问题....
PDFSharp可以在PDF上创建注释吗?我认为他们可以在Acrobat中移动。
我其实只是迪斯科通过PDF编辑器对象2.6。这个软件以最简单的方式做我正在寻找的东西。 – ajdams 2009-10-09 14:58:19
虽然答案很好= P – ajdams 2009-10-09 15:21:56