Java から TIFF に注釈を付ける


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

Java API の GroupDocs.Annotation について

GroupDocs.Annotation for Java API は、Mac、Windows、または Ubuntu 上の PDF、Word、およびその他のドキュメントに注釈を追加できるようにするライブラリです。 GroupDocs.Annotation for Java は、画像やその他のさまざまなドキュメントからの注釈の作成、追加、編集、削除、抽出、エクスポートを包括的にサポートする注釈管理用のネイティブ Java API です。サポートされているドキュメント形式の完全なリストは、この ページ で確認できます。 このライブラリを使用すると、TIFF ドキュメントだけでなく、Word、Excel、PowerPoint、Outlook 電子メール、Visio、Adobe、OpenDocument、OpenOffice、Photoshop、AutoCad など、他の多くのタイプのドキュメントでも作業できます。 GroupDocs.Annotation for Java API を使用すると、新しいメモの作成と追加、注釈の編集、コメントや注釈の抽出、ドキュメントからの削除を行うことができます。このライブラリは、テキスト、ポリライン、エリア、下線、点、透かし、矢印、楕円、テキスト置換、距離、テキスト フィールド、PDF、HTML、Microsoft Word ドキュメント、スプレッドシート、図、プレゼンテーション、図面、画像、その他多くのファイル形式。 例 (以下を参照) は、TIFF ドキュメントの操作を示しています。この例では、GroupDocs.Annotation を使用する方法の主な手順を確認できます。ライセンスを設定し、操作したいドキュメントを開き、注釈を追加し、要件に従って注釈プロパティを設定し、結果を必要な場所に保存します。また、サポートされている機能の詳細については、github ページ または製品 ドキュメント

Java で TIFF に注釈を追加する手順

GroupDocs.Annotation Java 開発者は、いくつかの簡単な手順を実装することで、Java ベースのアプリケーション内の TIFF ファイルにさまざまな注釈タイプを簡単に追加できます。

  • コメントと日付を含む Reply オブジェクトを作成します。
  • AreaAnnotation オブジェクトを作成し、エリア オプションを設定し、応答を追加します。
  • Annotator オブジェクトを作成し、領域の注釈を追加します。
  • 出力ファイルを保存します。

システム要求

GroupDocs.Annotation for Java API は、すべての主要なプラットフォームとオペレーティング システムでサポートされています。以下のコードを実行する前に、次の前提条件がシステムにインストールされていることを確認してください。

  • オペレーティング システム: Microsoft Windows、Linux、MacOS
  • 開発環境: NetBeans、Intellij IDEA、Eclipse など
  • Java ランタイム環境: Java 7 (1.7) 以降
  • Java 用 GroupDocs.Annotation の最新バージョンを GroupDocs Artifact Repository から入手します。

注釈のプレビューとコードサンプル

// Create an instance of Reply class and add comments
Reply firstReply = new Reply();
firstReply.setComment("First comment");
firstReply.setRepliedOn(Calendar.getInstance().getTime());

Reply secondReply = new Reply();
secondReply.setComment("Second comment");
secondReply.setRepliedOn(Calendar.getInstance().getTime());

List<Reply> replies = new ArrayList<Reply>();
replies.add(firstReply);
replies.add(secondReply);

// Create an instance of AreaAnnotation class and set options
AreaAnnotation area = new AreaAnnotation();
area.setBackgroundColor(65535);
area.setBox(new Rectangle(100, 100, 100, 100));
area.setCreatedOn(Calendar.getInstance().getTime());
area.setMessage("This is area annotation");
area.setOpacity(0.7);
area.setPageNumber(0);
area.setPenColor(65535);
area.setPenStyle(PenStyle.Dot);
area.setPenWidth((byte) 3);
area.setReplies(replies);

// Create an instance of Annotator class
Annotator annotator = new Annotator("input.bmp");

// Add annotation
annotator.add(area);

// Save to file
annotator.save("output.bmp");
annotator.dispose();

Annotation preview image

Java で TIFF から注釈を削除する手順

GroupDocs.Annotation Java 開発者は、いくつかの簡単な手順を実装することで、Java ベースのアプリケーション内の TIFF ファイルから注釈の詳細を簡単に削除できます。

  • コメントと日付を含む Reply オブジェクトを作成します。
  • SaveOptions オブジェクトをインスタンス化し、AnnotationTypes = AnnotationType.None を設定します。
  • 結果のドキュメント パスまたはストリームと SaveOptions オブジェクトを使用して save メソッドを呼び出します。

// Create an instance of Annotator class 
Annotator annotator = new Annotator("C://input.bmp");

// Remove annotation by set type None 
SaveOptions saveOptions = new SaveOptions();
saveOptions.setAnnotationTypes(AnnotationType.None);

// Save annotation to output file
annotator.save("C://output.bmp", saveOptions);
annotator.dispose();

Java で TIFF から注釈を編集する手順

GroupDocs.Annotation Java 開発者は、いくつかの簡単な手順を実装することで、Java ベースのアプリケーション内の TIFF ファイルからさまざまな注釈プロパティを簡単に更新できるようになります。

  • ImportAnnotations = true でインスタンス化された LoadOptions を使用して、入力ドキュメント パスまたはストリームを使用して Annotator オブジェクトをインスタンス化します。
  • AnnotationBase 実装を作成し、存在するアノテーションの ID (その ID を持つアノテーションが見つからない場合は何も変更されません) またはアノテーションのパス リスト (存在するすべてのアノテーションが削除されます) を設定します。
  • 渡されたアノテーションを使用して Annotator オブジェクトの update メソッドを呼び出します。
  • 結果のドキュメント パスまたはストリームと SaveOptions オブジェクトを使用して save メソッドを呼び出します。

String outputPath = "UpdateAnnotation.bmp";

// Create an instance of Annotator class
Annotator annotator = new Annotator("input.bmp");

// Create an instance of Reply class for first example and add comments
Reply reply1 = new Reply();
reply1.setComment("Original first comment");
reply1.setRepliedOn(Calendar.getInstance().getTime());

Reply reply2 = new Reply();
reply2.setComment("Original second comment");
reply2.setRepliedOn(Calendar.getInstance().getTime());

java.util.List replies = new ArrayList();
replies.add(reply1);
replies.add(reply2);

// Create an instance of AreaAnnotation class and set options
AreaAnnotation original = new AreaAnnotation();
original.setId(1);
original.setBackgroundColor(65535);
original.setBox(new Rectangle(100, 100, 100, 100));
original.setCreatedOn(Calendar.getInstance().getTime());
original.setMessage("This is original annotation");
original.setReplies(replies);

// Add original annotation
annotator.add(original);
annotator.save(outputPath);
annotator.dispose();

LoadOptions loadOptions = new LoadOptions();

// Open annotated document
Annotator annotator1 = new Annotator(outputPath, loadOptions);

// Create an instance of Reply class for update first example
Reply reply3 = new Reply();
reply3.setComment("Updated first comment");
reply3.setRepliedOn(Calendar.getInstance().getTime());

Reply reply4 = new Reply();
reply4.setComment("Updated second comment");
reply4.setRepliedOn(Calendar.getInstance().getTime());

java.util.List replies1 = new ArrayList();
replies1.add(reply3);
replies1.add(reply4);

// Suggest we want change some properties of existed annotation
AreaAnnotation updated = new AreaAnnotation();
updated.setId(1);
updated.setBackgroundColor(255);
updated.setBox(new Rectangle(0, 0, 50, 200));
updated.setCreatedOn(Calendar.getInstance().getTime());
updated.setMessage("This is updated annotation");
updated.setReplies(replies1);

// Update and save annotation
annotator1.update(updated);
annotator1.save(outputPath);
annotator1.dispose();

Java で TIFF から注釈を抽出する手順

GroupDocs.Annotation Java 開発者は、いくつかの簡単な手順を実装することで、Java ベースのアプリケーション内の TIFF ファイルからドキュメントに注釈を付けたり、注釈情報を抽出したりすることが簡単になります。

  • コメントと日付を含む Reply オブジェクトを作成します。
  • LoadOptions オブジェクトをインスタンス化し、true 引数を指定して SetImportAnnotations を呼び出します。
  • List型の変数を定義します。
  • get メソッドを呼び出し、結果を上記の変数に返します。

// For using this example input file ("annotated.bmp") must be with annotations
LoadOptions loadOptions = new LoadOptions();

// Create an instance of Annotator class and get annotations
final Annotator annotator = new Annotator("annotated.bmp", loadOptions);
List annotations = annotator.get();

ドキュメントや画像に注釈を追加、削除、編集、抽出するライブデモ

GroupDocs.Annotation Live Demos Web サイトにアクセスして、今すぐ TIFF ファイルに注釈を追加、削除、編集、抽出します。 ライブデモには次のようなメリットがあります

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

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

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

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

TIFF ファイル形式について

TIFF または TIF (Tagged Image File Format) は、このファイル形式標準に準拠するさまざまなデバイスでの使用を目的としたラスター イメージを表します。複数の色空間で二値、グレースケール、パレットカラー、およびフルカラーの画像データを記述することができます。非可逆圧縮スキームと可逆圧縮スキームをサポートし、この形式を使用するアプリケーションのスペースと時間を選択します。この形式は拡張可能であり、数回の改訂が行われ、プライベートまたは特殊な目的の情報を無制限に含めることができます。この形式はマシンに依存せず、プロセッサ、オペレーティング システム、ファイル システムなどの制限もありません。

続きを読む TIFF ファイル形式について

他の一般的なドキュメント形式の使用

以下に示すように、いくつかの一般的なファイル形式から注釈プロパティを更新します。

Annotate PDF document

(Adobe Portable Document Format)

Annotate DOC document

(Microsoft Word Document)

Annotate DOCM document

(Microsoft Word Macro-Enabled Document)

Annotate DOCX document

(Microsoft Word Open XML Document)

Annotate DOT document

(Microsoft Word Document Template)

Annotate DOTX document

(Word Open XML Document Template)

Annotate RTF document

(Rich Text Document)

Annotate ODT document

(Open Document Text)

Annotate XLS document

(Microsoft Excel Binary File Format)

Annotate XLSX document

(Microsoft Excel Open XML Spreadsheet)

Annotate XLSM document

(Microsoft Excel Macro-Enabled Spreadsheet)

Annotate XLSB document

(Microsoft Excel Binary Worksheet)

Annotate ODS document

(Open Document Spreadsheet)

Annotate PPT document

(PowerPoint Presentation)

Annotate PPTX document

(PowerPoint Open XML Presentation)

Annotate PPSX document

(PowerPoint Open XML Slide Show)

Annotate POTM document

(Microsoft PowerPoint Template)

Annotate PPTM document

(Microsoft PowerPoint Presentation)

Annotate PPS document

(Microsoft PowerPoint 97-2003 Slide Show)

Annotate ODP document

(OpenDocument Presentation)

Annotate HTML document

(HyperText Markup Language)

Annotate TIFF document

(Tagged Image File Format)

Annotate PNG document

(Portable Network Graphic)

Annotate EML document

(E-mail Message)

Annotate MSG document

(Microsoft Outlook E-mail Message)

Annotate VSD document

(Microsoft Visio 2003-2010 Drawing)

Annotate VSDX document

(Microsoft Visio Drawing)

Annotate VSS document

(Microsoft Visio 2003-2010 Stencil)

Annotate VST document

(Microsoft Visio 2013 Stencil)

Annotate DWG document

(Autodesk Design Data Formats)

Annotate DXF document

(AutoCAD Drawing Interchange)

Annotate DCM document

(Digital Imaging and Communications in Medicine)

Annotate WMF document

(Windows Metafile)

Annotate EMF document

(Enhanced Metafile Format)

Back to top
 日本