做印刷广告的图片在哪个网站找wordpress插件目录下
2026/6/9 12:01:32 网站建设 项目流程
做印刷广告的图片在哪个网站找,wordpress插件目录下,用自己服务器做网站用备案,聚兴大宗现货交易平台除文本和图形外#xff0c;PDF 文件还可以包含作为附件嵌入的完整文件。这使得成套文档的交换更加方便和可靠。Spire.PDF 提供两种方式来添加附件#xff1a;文档级附件#xff08;Document Level Attachment#xff09;#xff1a;附加在 PDF 文档级别的文件不会出现在页…除文本和图形外PDF 文件还可以包含作为附件嵌入的完整文件。这使得成套文档的交换更加方便和可靠。Spire.PDF 提供两种方式来添加附件文档级附件Document Level Attachment附加在 PDF 文档级别的文件不会出现在页面上只能在 PDF 阅读器的“附件”面板中查看。注释级附件Annotation Attachment文件会被添加到页面的特定位置。此类附件以回形针图标显示在页面上审阅者可双击图标打开文件。本文演示如何使用 Spire.PDF for .NET 在 C# 和 VB.NET 中向 PDF 文档添加或删除这两种类型的附件。安装 Spire.PDF for .NET首先您需要将 Spire.PDF for .NET 包中的 DLL 文件作为引用添加到您的 .NET 项目中。您可以通过此链接下载这些 DLL 文件或通过 NuGet 进行安装。PM Install-Package Spire.PDF在 C# 和 VB.NET 中向 PDF 添加附件通过使用PdfDocument.Attachments.Add()方法可以轻松将附件添加到“附件”面板。以下是具体步骤创建一个PdfDocument对象。使用PdfDocument.LoadFromFile()方法加载 PDF 文档。基于外部文件创建一个PdfAttachment对象。使用PdfDocument.Attachments.Add()方法将附件添加到 PDF 中。使用PdfDocument.SaveToFile()方法将文档保存为新的 PDF 文件。示例代码如下using Spire.Pdf; using Spire.Pdf.Attachments; namespace AttachFilesToPDF { class Program { static void Main(string[] args) { //创建 PdfDocument 对象 PdfDocument doc new PdfDocument(); //加载示例 PDF 文件 doc.LoadFromFile(C:\\Users\\Administrator\\Desktop\\Sample.pdf); //基于外部文件创建 PdfAttachment 对象 PdfAttachment attachment new PdfAttachment(C:\\Users\\Administrator\\Desktop\\Data.xlsx); //将附件添加到 PDF doc.Attachments.Add(attachment); //保存文档 doc.SaveToFile(Attachment.pdf); } } }在 C# 和 VB.NET 中向 PDF 添加注释级附件注释级附件既会显示在“附件”面板中也会出现在文档的特定页面上。示例代码如下using Spire.Pdf; using Spire.Pdf.Annotations; using Spire.Pdf.Graphics; using System; using System.Drawing; using System.IO; namespace AnnotationAttachment { class Program { static void Main(string[] args) { //创建 PdfDocument 对象 PdfDocument doc new PdfDocument(); //加载示例 PDF 文件 doc.LoadFromFile(C:\\Users\\Administrator\\Desktop\\Sample.pdf); //获取指定页 PdfPageBase page doc.Pages[0]; //在 PDF 上绘制文字标签 String label Here is the report:; PdfTrueTypeFont font new PdfTrueTypeFont(new Font(Arial, 13f, FontStyle.Bold), true); float x 35; float y doc.Pages[0].ActualSize.Height - 220; page.Canvas.DrawString(label, font, PdfBrushes.Red, x, y); //基于外部文件创建 PdfAttachmentAnnotation 对象 String filePath C:\\Users\\Administrator\\Desktop\\Report.pptx; byte[] data File.ReadAllBytes(filePath); SizeF size font.MeasureString(label); RectangleF bounds new RectangleF((float)(x size.Width 5), (float)y, 10, 15); PdfAttachmentAnnotation annotation new PdfAttachmentAnnotation(bounds, Report.docx, data); annotation.Color Color.Purple; annotation.Flags PdfAnnotationFlags.Default; annotation.Icon PdfAttachmentIcon.Graph; annotation.Text Click here to open the file; //将注释附件添加到 PDF 页面 page.AnnotationsWidget.Add(annotation); //保存文档 doc.SaveToFile(Annotation.pdf); } } }在 C# 和 VB.NET 中从 PDF 中移除附件可以通过PdfDocument.Attachments属性访问 PDF 文档中的附件并使用PdfAttachmentCollection对象的RemoveAt()方法或Clear()方法来删除附件。示例代码如下using Spire.Pdf; using Spire.Pdf.Attachments; namespace RemoveAttachments { class Program { static void Main(string[] args) { //创建 PdfDocument 对象 PdfDocument doc new PdfDocument(); //加载 PDF 文件 doc.LoadFromFile(C:\\Users\\Administrator\\Desktop\\Attachment.pdf); //获取附件集合 PdfAttachmentCollection attachments doc.Attachments; //删除指定附件 attachments.RemoveAt(0); //删除所有附件 //attachments.Clear(); //保存文件 doc.SaveToFile(DeleteAttachments.pdf); } } }在 C# 和 VB.NET 中从 PDF 中移除注释级附件注释是基于页面的元素。若要获取文档中的所有注释需要遍历每一页并获取该页上的注释。接着判断某个注释是否为注释级附件最后通过注释集合的Remove()方法将其移除。示例代码如下using Spire.Pdf; using Spire.Pdf.Annotations; namespace RemoveAnnotationAttachments { class Program { static void Main(string[] args) { //创建 PdfDocument 对象 PdfDocument doc new PdfDocument(); //加载 PDF 文件 doc.LoadFromFile(C:\\Users\\Administrator\\Desktop\\Annotation.pdf); //遍历所有页面 for (int i 0; i doc.Pages.Count; i) { //获取注释集合 PdfAnnotationCollection annotationCollection doc.Pages[i].AnnotationsWidget; //遍历注释 for (int j 0; j annotationCollection.Count; j) { //判断当前注释是否为 PdfAttachmentAnnotationWidget 类型 if (annotationCollection[j] is PdfAttachmentAnnotationWidget) { //移除注释附件 annotationCollection.Remove((PdfAnnotation)annotationCollection[j]); } } } //保存文件 doc.SaveToFile(DeleteAnnotationAttachments.pdf); } } }申请临时许可证如果您想去除生成文档中的评估提示或解除功能限制请申请一个 30 天的试用许可证。

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询