// using System.IO;
// using System.Runtime.InteropServices;
[DllImport("pdftool.dll")]
private static extern IntPtr LoadPDF(string OpenFileName);
[DllImport("pdftool.dll")]
private static extern bool FreePDF(IntPtr pdf);
[DllImport("pdftool.dll")]
private static extern int GetPDFPageCount(IntPtr pdf); // ページ数取得
[DllImport("pdftool.dll")]
private static extern int RotatePDF(IntPtr pdf, int StartPos, int EndPos, string SaveFileName, int Rotate);
IntPtr hPDF = LoadPDF(@"C:\original.pdf");
int pagecnt = GetPDFPageCount(hPDF);
RotatePDF(hPDF, 1, pagecnt, @"C:\rotate.pdf", 1); // Rotate:1…右90度 2…左90度 3…180度
FreePDF(hPDF);
|