Aspose.TeXの出力インターフェイス| C++

I/O実装の正式な定義については、C++ 用の Aspose.TeX api参照を参照してください。

出力ディレクトリの概念

Tex言語のI/O Primitivesはファイル名のみを扱うことができるため、Aspose.TeXは、ディレクトリを名前とデータのバルクのマッピングとして定義します。データの大部分は、ファイル、ストリーム、配列などであるはずです。APIにより、入力および出力作業ディレクトリを個別に指定できます。一般的な ioutputworkingdirectoryの出力のインターフェイスを提供します。これは、ユーザーが独自の目的で実装できます。また、独自の実装も提供します。これについては、以下で説明します。インターフェイスは iinputworkingdirectoryを拡張します。エンジンが最初にファイルを作成して書き込み、次に読み戻すことができるためです。インターフェイス独自のメソッド getOutputFile()は、 getFile()によって返された読み取りを読み取るストリームとは対照的に、ストリームを返して書き込みます。

ディスクファイルシステムへのファイル出力の書き込み

上記に述べたように、 outputDirectoryの最も一般的な値は、 outputFilesSystemDirectoryクラスのインスタンスになる可能性があります。

これが私たちがそれを設定する方法です:

1// Create conversion options instance.
2...
3// Specify a file system working directory for the output.
4options->set_OutputWorkingDirectory(System::MakeObject<OutputFileSystemDirectory>(RunExamples::OutputDirectory));

このユースケースは非常に簡単なので、もうそれに集中する必要はありません。

ZIPアーカイブへのファイル出力の書き込み

また、ファイル(またはストリーム)を作成し、TexエンジンにZIPアーカイブとして使用して出力ファイルを保存することもできます。ここにあります:

1    // Open the stream for the ZIP archive that will serve as the output working directory.
2    System::SharedPtr<System::IO::Stream> outZipStream = System::IO::File::Open(System::IO::Path::Combine(RunExamples::OutputDirectory, u"zip-pdf-out.zip"), System::IO::FileMode::Create);
3
4    // Create conversion options instance.
5    ...
6    // Specify a ZIP archive working directory for the output.
7    options->set_OutputWorkingDirectory(System::MakeObject<OutputZipDirectory>(outZipStream));

まず、zipファイルの出力ストリームを作成します。次に、変換オプションを作成した後、 outputzipdirectoryクラスのインスタンスになるように outputworkingdirectoryオプションを設定します。

出力端子の概念

出力には別の重要な部分があります—端子出力。これについては、C++ 用の Aspose.TeXは、 textwriter実装インスタンスを返すプロパティが1つだけある一般 ioutputterminalインターフェイスを定義します。実装を以下で説明します。

コンソールへの端子出力の書き込み

これを行うには、 OutputConsoleterminalクラスのインスタンスになるには、 Terminaloutオプションを設定する必要があります。

1// Create conversion options instance.
2...
3// Specify the console as the output terminal.
4options->set_TerminalOut(System::MakeObject<OutputConsoleTerminal>()); // Default. No need to specify.

繰り返しますが、これはオプションのデフォルト値であるため、指定する必要はありません。このため、このセクションはデモンストレーションのみを提供します。

ファイルへの端子出力の書き込み

入力端子とは異なり、C++ 用の Aspose.TeXioutputterminalの実装を提供します。

1// Create conversion options instance.
2...
3// Specify that the terminal output must be written to a file in the output working directory.
4// The file name is <job_name>.trm.
5options->set_TerminalOut(System::MakeObject<OutputFileTerminal>(options->get_OutputWorkingDirectory()));

ここでは、TEXエンジンに、 <job_name>.trmという名前のファイルに端子出力を書き込むように依頼します。しかし、これは必要ありません。 ioutputterminalの実装の他のインスタンスをコンストラクターに渡すこともできます。

Have any questions about Aspose.TeX?



Subscribe to Aspose Product Updates

Get monthly newsletters & offers directly delivered to your mailbox.