首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用Aspose.Pdf库制作1层pdf

使用Aspose.Pdf库制作1层pdf
EN

Stack Overflow用户
提问于 2013-03-19 10:52:04
回答 1查看 2.3K关注 0票数 2

我用Aspose.Pdf表示.NET。

我想做的是:

用1层制作pdf (最好的解决方案是在生成pdf之前,所有用过的文本和背景图像都作为图片,然后生成pdf),我需要它来禁止更改我的pdf简单安全的pdf文件中的内容是不够的,因为即使在线pdf到文档转换器也可以更改内容。

现在有办法做到这一点吗?或者,在将其放到pdf网站之前,是否有任何方法从内容中生成图像?

我能够生成pdf,但有多个层(在我的场景中有2个)。

对于.net 4.0客户端,我使用了DLDLVersion5.0.0。

(预先谢谢:)

EN

回答 1

Stack Overflow用户

发布于 2013-03-26 06:33:32

使用Aspose.Pdf,您可以在PDF文档上设置几个特权来控制它们的使用。使用Aspose.Pdf指定以下安全选项,您生成的Pdf文档将表现为不可编辑的只读文档:

代码语言:javascript
运行
复制
//Instantiate Pdf instance by calling its empty constructor
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();

//Assign a security instance to Pdf object            
pdf1.Security = new Aspose.Pdf.Generator.Security();

//Restrict annotation modification
pdf1.Security.IsAnnotationsModifyingAllowed = false;

//Restrict contents modification
pdf1.Security.IsContentsModifyingAllowed = false;

//Restrict copying the data
pdf1.Security.IsCopyingAllowed = false;

//Allow to print the document
pdf1.Security.IsPrintingAllowed = true;

//Restrict form filling
pdf1.Security.IsFormFillingAllowed = false;

//Add a section in the Pdf
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();

//Create a text paragraph and set top margin
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(sec1,"this is text content");
text1.Margin.Top = 30;

//Add image
Aspose.Pdf.Generator.Image img = new Aspose.Pdf.Generator.Image();
img.ImageInfo.File = "asposelogo.png";
img.ImageInfo.ImageFileType = Aspose.Pdf.Generator.ImageFileType.Png;

//Add the text paragraph and image to the section
sec1.Paragraphs.Add(text1);
sec1.Paragraphs.Add(img);

//Save the Pdf                            
pdf1.Save("test.pdf");

至于将PDF的全部内容创建为嵌入式映像,它在Aspose.Pdf中并不直接支持。但是,您可以使用一些方法或其他组件来生成内容的映像,然后可以使用此映像使用Aspose.Pdf创建Pdf文件,如下所示:

  • 用您的内容生成PDF (您之前创建的多层PDF )
  • 将PDF导出到图像中,如Aspose.Pdf文档的“Aspose.Pdf”部分所述。
  • 使用导出的图像创建PDF格式,如"处理图像(生成器)“所述,并分发您的文档。

我的名字是Iqbal,我是Aspose的开发者传道者。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15497410

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档