没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|行业资讯|编辑:胡涛|2024-09-29 13:51:11.743|阅读 70 次
概述:在本文中,我们将演示如何使用Spire.PDF for .NET在 C# 和 VB.NET 中为 PDF 文档设置查看器首选项和缩放因子。
# 界面/图表报表/文档/IDE等千款热门软控件火热销售中 >>
相关链接:
优化查看器首选项和缩放因子对于改善 PDF 文档的查看体验至关重要。通过使用适当的查看器首选项和缩放因子,您可以使您的 PDF 文档更加用户友好、可查看且适合不同的设备和平台。在本文中,我们将演示如何使用Spire.PDF for .NET在 C# 和 VB.NET 中为 PDF 文档设置查看器首选项和缩放因子。
Spire.PDF for .NET 是一款独立 PDF 控件,用于 .NET 程序中创建、编辑和操作 PDF 文档。使用 Spire.PDF 类库,开发人员可以新建一个 PDF 文档或者对现有的 PDF 文档进行处理,且无需安装 Adobe Acrobat。
E-iceblue 功能类库Spire 系列文档处理组件均由中国本土团队研发,不依赖第三方软件,不受其他国家的技术或法律法规限制,同时适配国产操作系统如中科方德、中标麒麟等,兼容国产文档处理软件 WPS(如 .wps/.et/.dps 等格式
首先,您需要将 Spire.PDF for.NET 包中包含的 DLL 文件作为引用添加到您的 .NET 项目中。 可以从此链接下载 DLL 文件,也可以通过NuGet安装。
PM> Install-Package Spire.PDF
查看器首选项是可应用于 PDF 文档的设置,用于控制在 PDF 查看器中打开时文档的显示方式。这些首选项会影响查看体验的各个方面,例如初始视图、页面布局和导航选项卡。
要使用 Spire.PDF for .NET 设置 PDF 文档的查看器首选项,您可以按照以下步骤操作:
【C# 】
using Spire.Pdf; namespace SetViewerPreference { internal class Program { static void Main(string[] args) { //Initialize an instance of PdfDocument class PdfDocument pdf = new PdfDocument(); //Load a PDF document pdf.LoadFromFile(@"Example.pdf"); //Get the PdfViewerPreferences object PdfViewerPreferences viewerPreferences = pdf.ViewerPreferences; //Set viewer preference viewerPreferences.FitWindow = false; viewerPreferences.HideMenubar = true; viewerPreferences.HideToolbar = true; viewerPreferences.CenterWindow= true; viewerPreferences.DisplayTitle = false; viewerPreferences.PageLayout = PdfPageLayout.SinglePage; viewerPreferences.PageMode = PdfPageMode.UseNone; //Save the result document pdf.SaveToFile("SetViewerPreference.pdf"); pdf.Close(); } } }
【VB.NET 】
Imports Spire.Pdf Namespace SetViewerPreference Friend Class Program Private Shared Sub Main(ByVal args As String()) 'Initialize an instance of PdfDocument class Dim pdf As PdfDocument = New PdfDocument() 'Load a PDF document pdf.LoadFromFile("Example.pdf") 'Get the PdfViewerPreferences object Dim viewerPreferences As PdfViewerPreferences = pdf.ViewerPreferences 'Set viewer preference viewerPreferences.FitWindow = False viewerPreferences.HideMenubar = True viewerPreferences.HideToolbar = True viewerPreferences.CenterWindow = True viewerPreferences.DisplayTitle = False viewerPreferences.PageLayout = PdfPageLayout.SinglePage viewerPreferences.PageMode = PdfPageMode.UseNone 'Save the result document pdf.SaveToFile("SetViewerPreference.pdf") pdf.Close() End Sub End Class End Namespace
缩放系数决定了 PDF 文档打开时的缩放级别。默认情况下,大多数 PDF 查看器将缩放系数设置为“适合页面”,即缩放文档以适合查看器窗口的宽度。但是,您也可以根据需要设置特定的缩放系数,例如 60%、150% 或 200%。
要使用 Spire.PDF for .NET 设置 PDF 文档的缩放比例,您可以按照以下步骤操作:
【C# 】
using Spire.Pdf; using Spire.Pdf.Actions; using Spire.Pdf.General; using System.Drawing; namespace SetZoomFactor { internal class Program { static void Main(string[] args) { //Initialize an instance of the PdfDocument class PdfDocument pdf = new PdfDocument(); //Load a PDF document pdf.LoadFromFile(@"Example.pdf"); //Get the first page PdfPageBase page = pdf.Pages[0]; //Initialize an instance of the PdfDestination class PdfDestination dest = new PdfDestination(page); //Set the destination mode dest.Mode = PdfDestinationMode.Location; //Set the destination location dest.Location = new PointF(40f, 40f); //Set the zoom factor dest.Zoom = 1.5f; //Initialize an instance of the PdfGoToAction class PdfGoToAction gotoAction = new PdfGoToAction(dest); //Set the action to be executed when the document is opened pdf.AfterOpenAction = gotoAction; //Save the result document pdf.SaveToFile("SetZoomFactor.pdf"); pdf.Close(); } } }
【VB.NET 】
Imports Spire.Pdf Imports Spire.Pdf.Actions Imports Spire.Pdf.General Imports System.Drawing Namespace SetZoomFactor Friend Class Program Private Shared Sub Main(ByVal args As String()) 'Initialize an instance of the PdfDocument class Dim pdf As PdfDocument = New PdfDocument() 'Load a PDF document pdf.LoadFromFile("Example.pdf") 'Get the first page Dim page As PdfPageBase = pdf.Pages(0) 'Initialize an instance of the PdfDestination class Dim dest As PdfDestination = New PdfDestination(page) 'Set the destination mode dest.Mode = PdfDestinationMode.Location 'Set the destination location dest.Location = New PointF(40F, 40F) 'Set the zoom factor dest.Zoom = 1.5F 'Initialize an instance of the PdfGoToAction class Dim gotoAction As PdfGoToAction = New PdfGoToAction(dest) 'Set the action to be executed when the document is opened pdf.AfterOpenAction = gotoAction 'Save the result document pdf.SaveToFile("SetZoomFactor.pdf") pdf.Close() End Sub End Class End Namespace
欢迎下载|体验更多E-iceblue产品
获取更多信息请咨询慧都在线客服 ;技术交流Q群(767755948)
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
跨团队协作中,测试信息的孤岛化与不同角色间的“理解鸿沟”严重阻碍协作效率。开发、测试与非技术成员常因信息分散或表述晦涩而难以高效协同。TestComplete自动化测试方案通过丰富的多格式报告、直观的可视化证据以及与现有工具链的无缝集成,打破信息壁垒,确保所有相关方都能便捷、清晰地获取和理解关键测试结果。
需求管理一直是软件开发与系统设计过程的关键环节,但也常常面临诸多痛点:需求描述模糊、变更频繁导致信息混乱,各环节追溯困难,以及团队成员与利益相关者之间协作效率低下。针对这些挑战,企业级建模平台Sparx EA通过强大的需求建模功能与可视化工具提供了高效解决方案。它支持需求的精细化属性管理、全流程追溯关联,以及多样化的图表展示,帮助团队清晰定义需求、实时跟踪状态,并确保信息透明共享。
HOOPS Web Platform不仅帮助RIB成功完成了iTWO从桌面到云端的跨越,更为建筑行业的数字化转型提供了强大的可视化引擎。未来,它将继续推动建筑管理走向更加智能与高效的新时代。
在大型技术项目中,工具链割裂、协作低效、安全失控是架构师与开发团队的共性痛点。Sparx Systems的Enterprise Architect(Sparx EA)终极版以四大核心技术能力直击这些挑战,成为企业级建模与系统工程的战略级解决方案。本文将深度解析其技术竞争力内核。
Spire.PDF for .NET是独立的PDF控件,用于.NET程序中创建、编辑和操作PDF文档
Spire.Office for .NET专业的.NET Office套件,涵盖office文档创建、编辑、转换、管理和OCR内容识别等操作
Spire.Doc for .NETSpire.Doc for .NET 是一款专门对 Word 文档进行操作的 .NET 类库。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号