/* Antenna House PDF Tool API V8.0 .NET Interface sample program 概要:ページの拡大縮小 Copyright 2015-2025 Antenna House, Inc. */ using System; using PdfTkNet; namespace ZoomPage { class Program { static void Main(string[] args) { if (args.Length < 2) { Console.WriteLine("usage: ZoomPage.exe in-pdf-file out-pdf-file"); return; } try { using (PtlParamInput inputFile = new PtlParamInput(args[0])) using (PtlParamOutput outputFile = new PtlParamOutput(args[1])) using (PtlPDFDocument doc = new PtlPDFDocument()) { // PDFファイルをロードします。 doc.load(inputFile); using (PtlPages pages = doc.getPages()) // ページコンテナ { // ページコンテナが空かどうか if (pages.isEmpty()) { Console.WriteLine("ページコンテナが空"); return; } int numPages = doc.getPageCount(); for (int i = 0; i < numPages; ++i) { using (PtlPage page = pages.get(i)) // ページの取得 { page.zoom(0.5f); //page.zoom(2.0f); } } } // ファイルに保存します。 doc.save(outputFile); } } catch (PtlException pex) { Console.WriteLine(pex.getErrorCode() + " : " + pex.getErrorMessageJP()); pex.Dispose(); } catch (Exception ex) { Console.WriteLine(ex.Message); } finally { Console.WriteLine("-- 完了 --"); } } } }