v25.11
新しいプラグイン PDF Converter
- Class PdfConverter: プラグイン DocConverter、XlsConverter、HtmlConverter、JpegConverter、PdfAConverter、PngConverter、TiffConverter のすべての機能を含みます。
- Class DocConverter: まもなく削除されます。PdfConverter を使用してください。
- Class XlsConverter: まもなく削除されます。PdfConverter を使用してください。
- Class HtmlConverter: まもなく削除されます。PdfConverter を使用してください。
- Class JpegConverter: まもなく削除されます。PdfConverter を使用してください。
- Class PdfAConverter: まもなく削除されます。PdfConverter を使用してください。
- Class PngConverter: まもなく削除されます。PdfConverter を使用してください。
- Class TiffConverter: まもなく削除されます。PdfConverter を使用してください。
- Class PdfAConvertOptions: 名前が Class PdfToPdfAOptions に変更されました。
- 詳しくは The New Plugin Architecture を参照してください。
使用例:
この例は PDF ドキュメントを Doc 形式に変換する方法を示しています。
// Create PdfToDocOptions object to set instructions
var options = new PdfToDocOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_file.doc"));
// Perform the process
PdfConverter.Convert(options);使用例:
この例は PDF を XLSX ドキュメントに変換する方法を示しています。
// Create PdfToXlsOptions object to set instructions
var options = new PdfToXlsOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_xlsx_file.xlsx"));
// Perform the process
PdfConverter.Convert(options);使用例:
この例は PDF を HTML ドキュメントに変換する方法を示しています。
// Create PdfToHtmlOptions object to set output data type as file with embedded resources
var options = new PdfToHtmlOptions(PdfToHtmlOptions.SaveDataType.FileWithEmbeddedResources);
// Add input file path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.html"));
//Perform the process
PdfConverter.Convert(options);使用例:
この例は HTML を PDF ドキュメントに変換する方法を示しています。
// Create HtmlToPdfOptions
var options = new HtmlToPdfOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_input.html"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_output.pdf"));
//Perform the process
PdfConverter.Convert(options);使用例:
この例は PDF ドキュメントを JPEG 形式に変換する方法を示しています。
// Create PdfToJpegOptions object to set instructions
var options = new PdfToJpegOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);使用例:
この例は PDF ドキュメントを PNG 形式に変換する方法を示しています。
// Create PdfToPngOptions object to set instructions
var options = new PdfToPngOptions();
// Add input File path
options.AddInput(new FileDataSource("path_to_input.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);使用例:
この例は PDF ドキュメントを TIFF 形式に変換する方法を示しています。
// Create PdfToTiffOptions object to set instructions
var options = new PdfToTiffOptions();
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output Directory path
options.AddOutput(new DirectoryDataSource("path_to_output_directory"));
// Perform the process
PdfConverter.Convert(options);使用例:
この例は PDF ドキュメントを PDF/A 形式(この例では PDF/A‑3b)に変換する方法を示しています。
// Create the options class to set up the conversion process
var options = new PdfToPdfAOptions
{
PdfAVersion = PdfAStandardVersion.PDF_A_3B
};
// Add the source file
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf")); // replace with your actual file path
// Add the path to save the converted file
options.AddOutput(new FileDataSource("path_to_the_converted_file.pdf"));
// Run the conversion
PdfConverter.Convert(options);使用例:
この例は PDF ドキュメントが PDF/A 形式(この例では PDF/A‑1a)に準拠しているかを検証する方法を示しています。
// Create the options class to set up the validation process
var options = new PdfAValidateOptions
{
PdfAVersion = PdfAStandardVersion.PDF_A_1A
};
// Add one or more files to be validated
options.AddInput(new FileDataSource("path_to_your_first_pdf_file.pdf")); // replace with your actual file path
options.AddInput(new FileDataSource("path_to_your_second_pdf_file.pdf"));
// add more files as needed
// Run the validation and get results
var resultContainer = PdfConverter.Validate(options);
// Check the resultContainer.ResultCollection property for validation results for each file:
for (var i = 0; i < resultContainer.ResultCollection.Count; i++)
{
var result = resultContainer.ResultCollection[i];
var validationResult = (PdfAValidationResult) result.Data;
var isValid = validationResult.IsValid; // Validation result for the i-th document
}新しいプラグイン PDF Security
- Class PdfSecurity: プラグイン Security、Signature、Timestamp のすべての機能を含みます。
- Class Security: まもなく削除されます。PdfSecurity を使用してください。
- Class Signature: まもなく削除されます。PdfSecurity を使用してください。
- Class Timestamp: まもなく削除されます。PdfSecurity を使用してください。
- Class DecryptionOptions: 名前が Class DecryptOptions に変更されました。
- Class EncryptionOptions: 名前が Class EncryptOptions に変更されました。
- Class SignOptions: 現在、Class Timestamp 用のプロパティを持ちます。
- 詳しくは The New Plugin Architecture を参照してください。
使用例:
この例は PDF ドキュメントを暗号化する方法を示しています。
// Create EncryptOptions object to set instructions
var options = new EncryptOptions("123456", "qwerty");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Encrypt(options);使用例:
この例は PDF ドキュメントを復号化する方法を示しています。
// Create DecryptOptions object to set instructions
var options = new DecryptOptions("123456");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Decrypt(options);使用例:
この例は PDF ドキュメントに署名する方法を示しています。
// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_of_your_pfx_file");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);使用例:
この例は タイムスタンプ付きで PDF ドキュメントに署名する方法を示しています。
// Create SignOptions object to set instructions
var options = new SignOptions("path_to_your_pfx_file.pfx", "password_for_your_pfx_file");
options.TimestampOptions = new TimestampOptions("server_url");
// Add input file path
options.AddInput(new FileDataSource("path_to_your_pdf_file.pdf"));
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
// Perform the process
PdfSecurity.Sign(options);Plugin PdfChatGpt が PdfManager に統合
- Class PdfChatGpt: まもなく削除されます。PdfManager を使用してください。
- Class PdfChatGptRequestOptions: 名前が Class ChatGptRequestOptions に変更されました。
ChatGpt と連携するための新しいオプション
- Class ChatCompletion: リクエスト結果の確認が可能です。
- Class Choice: リクエスト結果の確認が可能です。
- Class Usage: リクエスト結果の確認が可能です。
- Class ChatGptConsts: ModelName、API URL などの追加設定が利用できます。
使用例:
この例はメッセージをリクエストに追加して ChatGpt を使用する方法を示しています。
var options = new ChatGptRequestOptions();
// Set output file path
options.AddOutput(new FileDataSource("path_to_result_pdf_file.pdf"));
options.ApiKey = "Your API key."; // You need to provide the key to access the API.
options.MaxTokens = 1000; // The maximum number of tokens to generate in the chat completion.
// Add the request messages.
options.Messages.Add(new Message
{
Content = "You are a helpful assistant.",
Role = Role.System
});
options.Messages.Add(new Message
{
Content = "What is the biggest pizza diameter ever made?",
Role = Role.User
});
// Process the request.
var result = await PdfManager.CreatePdfByChatGptRequestAsync(options);
var fileResultPath = result.ResultCollection[0].Data;
var chatCompletionObject = result.ResultCollection[1].Data as ChatCompletion; // The ChatGPT API chat completion object.改善点
- PDF から画像への変換 – パフォーマンス向上
- PDF から TIFF への変換 – 速度向上
- PDF から Doc への変換 – パフォーマンス向上
修正されたバグ
- HTML から PDF への変換 – 出力ファイルの書式設定問題を修正
- PDF から TIFF への変換のパフォーマンス問題を修正
- HTML から PDF への変換 – 外部リソースとしての CSS ファイルが生成された PDF に適用されない問題を修正