C# .NETのPDFを編集

Microsoft や Open Office などのソフトウェアを使用せずに、サーバー側の GroupDocs.Editor for C# .NET API を使用した効果的で堅牢な PDF 編集。


無料トライアルをダウンロード

GroupDocs.Editor for .NET API について

GroupDocs.Editor for .NET API は、Microsoft Word、Excel、PowerPoint、Open Office ドキュメントおよびプレゼンテーションを編集するための正しい選択です。 GroupDocs.Editor は、高いパフォーマンスが要求されるサーバー サイドおよびバックエンド システムに適したスタンドアロン API です。 Microsoft や Open Office などのソフトウェアには依存しません。

C# で PDF を編集する手順

GroupDocs.Editor for .NET は、開発者が数行のコードを使用して PDF ファイルを編集する簡単で直接的な方法を提供します。

  • 必須のファイル パスまたはストリームを使用して「Editor」クラスのインスタンスを作成し、PDF 用のオプションの「PdfLoadOptions」クラス (XPS には適用されません) を作成し、PDF ファイルをロードします。
  • PDF ファイル形式の PdfEditOptions クラス インスタンスを作成して設定します
  • Editor.Edit() メソッドを呼び出して、WYSIWYG エディタで簡単に編集できる HTML 形式の PDF ドキュメントを取得します。
  • Editor.Save() メソッドを呼び出し、PdfSaveOptions クラスを使用して編集済みの PDF ファイルを保存します

システム要求

GroupDocs.Editor for .NET API を使用した基本的なドキュメント編集は、いくつかの簡単な手順を実装することで実行できます。当社の API は、すべての主要なプラットフォームとオペレーティング システムでサポートされています。以下のコードを実行する前に、システムに次の前提条件がインストールされていることを確認してください。

  • オペレーティング システム: Microsoft Windows、Linux、MacOS
  • 開発環境: Microsoft Visual Studio, Xamarin, MonoDevelop
  • フレームワーク: .NET Framework, .NET Standard, .NET Core, Mono
  • NuGet からダウンロードした GroupDocs.Editor for .NET の最新バージョンを取得します

// Load the PDF file into Editor
Editor editor = new Editor("source.pdf");

// Create and adjust the PDF edit options
PdfEditOptions editOptions = new PdfEditOptions();

// Open input PDF document for edit — obtain an intermediate document, that can be edited
EditableDocument beforeEdit = editor.Edit(editOptions);

// Grab PDF document content and associated resources from editable document
string content = beforeEdit.GetEmbeddedHtml();

// Send the content to WYSIWYG-editor, edit it there, and send edited content back to the server-side
// This step simulates a such operation
string updatedContent = content.Replace("candy", "Edited candy");

// Grab edited content and resources from WYSIWYG-editor and create a new EditableDocument instance from it
EditableDocument afterEdit = EditableDocument.FromMarkup(updatedContent, null);

// Create a PDF save options        
PdfSaveOptions saveOptions = new PdfSaveOptions();

// Save edited PDF document to the file
editor.Save(afterEdit, outputPath, saveOptions);

PDFエディターのライブデモ

GroupDocs.Editor Live Demos Web サイトにアクセスして、今すぐ PDF を編集してください。 ライブデモには次の利点があります

APIをダウンロードする必要はありません

コードを書く必要はありません

ソースファイルをアップロードするだけです

ファイルを保存するためのダウンロードリンクを取得する

その他のサポートされているエディター

他のファイル形式を編集することもできます。以下の完全なリストをご覧ください。

DOC

(Microsoft Word Binary Format)

DOCX

(Office 2007+ Word Document)

DOCM

(Microsoft Word 2007 Marco File)

DOTX

(Microsoft Word Template File )

XLS

(Microsoft Excel Spreadsheet (Legacy))

XLSX

(Open XML Workbook)

XLSM

(Macro-enabled Spreadsheet)

PPT

(Microsoft PowerPoint 97-2003)

PPTX

(Open XML presentation Format)

PPTM

(Macro-enabled Presentation File)

MOBI

(Open Ebook Format)

EPUB

(Open eBook File)

HTML

(Hyper Text Markup Language)

MHTML

(Web Page Archive Format)

TXT

(Text Document)

XML

(XML File)

CSV

(Comma Seperated Values)

XPS

(XML Paper Specifications)

MSG

(Outlook Message Item File)

EML

(E-Mail Message)

Back to top
 日本