1、下载安装该类库后,在项目中引用Spire.PDF.dll(这里的dll文件可以在安装路径下的Bin文件夹中获取),并注意添加如下using指令【C#】using Spire.Pdf;
2、创建PdfDocument实例,并加载PDF文件【C#】PdfDocument pdf = new PdfDocument();pdf.LoadFromFile("CAD图纸.pdf");
3、获取第一页【C#】PdfPageBase page = pdf.Pages[0];
4、获取页面当前的旋转角度,然后在当前旋转角度的基础上旋转页面,角度可选0/90/180/270【C#】int rotat足毂忍珩ion = (int)page.Rotation;rotation += (int)PdfPageRotateAngle.RotateAngle270;page.Rotation = (PdfPageRotateAngle)rotation;
5、保存并打开文档【C#】pdf.SaveToFile("Output.pdf");System.Diagnostics.霸烹钟爷Process.Start("Output.pdf");
6、页面旋转后,效果对比: