没有找到合适的产品?
联系客服协助选型:023-68661681
提供3000多款全球软件/控件产品
针对软件研发的各个阶段提供专业培训与技术咨询
根据客户需求提供定制化的软件开发服务
全球知名设计软件,显著提升设计质量
打造以经营为中心,实现生产过程透明化管理
帮助企业合理产能分配,提高资源利用率
快速打造数字化生产线,实现全流程追溯
生产过程精准追溯,满足企业合规要求
以六西格玛为理论基础,实现产品质量全数字化管理
通过大屏电子看板,实现车间透明化管理
对设备进行全生命周期管理,提高设备综合利用率
实现设备数据的实时采集与监控
利用数字化技术提升油气勘探的效率和成功率
钻井计划优化、实时监控和风险评估
提供业务洞察与决策支持实现数据驱动决策
翻译|行业资讯|编辑:胡涛|2024-11-27 10:45:03.130|阅读 24 次
概述:在本文中,您将学习如何使用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
旋转以 90 度为增量。您可以将 PDF 页面旋转 0/90/180/270 度。以下是旋转 PDF 页面的步骤:
[C#]
using Spire.Pdf; namespace RotatePdfPage { class Program { static void Main(string[] args) { //Create a PdfDocument instance PdfDocument pdf = new PdfDocument(); //Load a PDF document pdf.LoadFromFile("Sample.pdf"); //Get the first page PdfPageBase page = pdf.Pages[0]; //Get the original rotation angle of the page int rotation = (int)page.Rotation; //Rotate the page 180 degrees clockwise based on the original rotation angle rotation += (int)PdfPageRotateAngle.RotateAngle180; page.Rotation = (PdfPageRotateAngle)rotation; //Save the result document pdf.SaveToFile("Rotate.pdf"); } } }
[VB.NET]
Imports Spire.Pdf Namespace RotatePdfPage Friend Class Program Private Shared Sub Main(ByVal args As String()) 'Create a PdfDocument instance Dim pdf As PdfDocument = New PdfDocument() 'Load a PDF document pdf.LoadFromFile("Sample.pdf") 'Get the first page Dim page As PdfPageBase = pdf.Pages(0) 'Get the original rotation angle of the page Dim rotation = CInt(page.Rotation) 'Rotate the page 180 degrees clockwise based on the original rotation angle rotation += CInt(PdfPageRotateAngle.RotateAngle180) page.Rotation = CType(rotation, PdfPageRotateAngle) 'Save the result document pdf.SaveToFile("Rotate.pdf") End Sub End Class End Namespace
以下是旋转 PDF 文档中所有页面的步骤:
[C#]
using Spire.Pdf; namespace RotateAllPdfPages { class Program { static void Main(string[] args) { //Create a PdfDocument instance PdfDocument pdf = new PdfDocument(); //Load a PDF document pdf.LoadFromFile("Sample.pdf"); foreach (PdfPageBase page in pdf.Pages) { //Get the original rotation angle of the page int rotation = (int)page.Rotation; //Rotate the page 180 degrees clockwise based on the original rotation angle rotation += (int)PdfPageRotateAngle.RotateAngle180; page.Rotation = (PdfPageRotateAngle)rotation; } //Save the result document pdf.SaveToFile("RotateAll.pdf"); } } }
[VB.NET]
Imports Spire.Pdf Namespace RotateAllPdfPages Friend Class Program Private Shared Sub Main(ByVal args As String()) 'Create a PdfDocument instance Dim pdf As PdfDocument = New PdfDocument() 'Load a PDF document pdf.LoadFromFile("Sample.pdf") For Each page As PdfPageBase In pdf.Pages 'Get the original rotation angle of the page Dim rotation = CInt(page.Rotation) 'Rotate the page 180 degrees clockwise based on the original rotation angle rotation += CInt(PdfPageRotateAngle.RotateAngle180) page.Rotation = CType(rotation, PdfPageRotateAngle) Next 'Save the result document pdf.SaveToFile("RotateAll.pdf") End Sub End Class End Namespace
欢迎下载|体验更多E-iceblue产品
获取更多信息请咨询慧都在线客服 ;技术交流Q群(767755948)
本站文章除注明转载外,均为本站原创或翻译。欢迎任何形式的转载,但请务必注明出处、不得修改原文相关链接,如果存在内容上的异议请邮件反馈至chenjj@evget.com
Parasoft Virtualize通过智能变更顾问、自动化工作流和全面版本控制三大核心功能,为企业提供了高效的虚拟化测试环境管理方案。它不仅大幅降低了维护成本和工作量,还确保了虚拟服务与真实环境的实时同步,显著提升了测试效率和可靠性。
Parasoft SOAtest凭借其精准消息推送、智能监听和高效依赖隔离的能力,为响应式微服务架构的测试提供了强有力的支持。它不仅解决了异步通信复杂、依赖服务多等测试难题,还通过模拟真实场景和简化测试环境,显著提升了测试效率和覆盖率。
作为一款面向全组织的CAD文件可视化与交互软件,SpinFire Insight支持多种主流2D和3D CAD格式,无需单独购买繁杂的CAD软件授权,即可实现对CAD模型的统一查看、分析和沟通,让企业内部及外部团队之间的跨部门、跨公司协作更加顺畅高效。
用于创建、存储和传输文档的 FastReport 产品线已通过新的开发进行了扩展。自 2025 年 5 月起,该产品线包含 Cloud、Corporate Server 和 Publisher 等产品。在本文中,我们将详细介绍这些服务如何满足不同的用户需求,以便您选择最符合您需求的解决方案。
Spire.PDF for .NET是独立的PDF控件,用于.NET程序中创建、编辑和操作PDF文档
Spire.PDF for WPFSpire.PDF for WPF 是一款让你的app能够读取、写入和操作PDF文档的完全独立的组件,不需要任何第三方组件库。
Spire.PDF Platinum Pack内容丰富的 PDF 工具套包。
服务电话
重庆/ 023-68661681
华东/ 13452821722
华南/ 18100878085
华北/ 17347785263
客户支持
技术支持咨询服务
服务热线:400-700-1020
邮箱:sales@evget.com
关注我们
地址 : 重庆市九龙坡区火炬大道69号6幢
慧都科技 版权所有 Copyright 2003-
2025 渝ICP备12000582号-13 渝公网安备
50010702500608号