v25.11
Plugin PDF Converter Baru
- Class PdfConverter: memuat semua fungsi plugin: DocConverter, XlsConverter, HtmlConverter, JpegConverter, PdfAConverter, PngConverter, TiffConverter.
- Class DocConverter: akan segera dihapus, gunakan PdfConverter.
- Class XlsConverter: akan segera dihapus, gunakan PdfConverter.
- Class HtmlConverter: akan segera dihapus, gunakan PdfConverter.
- Class JpegConverter: akan segera dihapus, gunakan PdfConverter.
- Class PdfAConverter: akan segera dihapus, gunakan PdfConverter.
- Class PngConverter: akan segera dihapus, gunakan PdfConverter.
- Class TiffConverter: akan segera dihapus, gunakan PdfConverter.
- Class PdfAConvertOptions: diganti nama menjadi Class PdfToPdfAOptions.
- Lihat Arsitektur Plugin Baru.
Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi dokumen PDF ke format 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi PDF ke dokumen 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi PDF ke dokumen 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi HTML ke dokumen 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi dokumen PDF ke format 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi dokumen PDF ke format 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi dokumen PDF ke format 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);Contoh Penggunaan:
Contoh ini menunjukkan cara mengonversi dokumen PDF ke format PDF/A (PDF/A-3b dalam kasus ini):
// 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);Contoh Penggunaan:
Contoh ini menunjukkan cara memvalidasi kepatuhan dokumen PDF terhadap format PDF/A (PDF/A-1a dalam kasus ini):
// 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
}Plugin PDF Security Baru
- Class PdfSecurity: memuat semua fungsi plugin: Security, Signature, Timestamp.
- Class Security: akan segera dihapus, gunakan PdfSecurity.
- Class Signature: akan segera dihapus, gunakan PdfSecurity.
- Class Timestamp: akan segera dihapus, gunakan PdfSecurity.
- Class DecryptionOptions: diganti nama menjadi Class DecryptOptions.
- Class EncryptionOptions: diganti nama menjadi Class EncryptOptions.
- Class SignOptions: kini memiliki properti untuk Class Timestamp.
- Lihat Arsitektur Plugin Baru.
Contoh Penggunaan:
Contoh ini menunjukkan cara Mengenkripsi dokumen 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);Contoh Penggunaan:
Contoh ini menunjukkan cara Mendekripsi dokumen 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);Contoh Penggunaan:
Contoh ini menunjukkan cara Menandatangani dokumen 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);Contoh Penggunaan:
Contoh ini menunjukkan cara Menandatangani dokumen PDF dengan Timestamp.
// 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 terintegrasi ke PdfManager
- Class PdfChatGpt: akan segera dihapus, gunakan PdfManager.
- Class PdfChatGptRequestOptions: diganti nama menjadi Class ChatGptRequestOptions.
Opsi baru untuk bekerja dengan ChatGpt
- Class ChatCompletion: memungkinkan pemeriksaan hasil permintaan.
- Class Choice: memungkinkan pemeriksaan hasil permintaan.
- Class Usage: memungkinkan pemeriksaan hasil permintaan.
- Class ChatGptConsts: memungkinkan penggunaan pengaturan tambahan seperti ModelName, URL API, dan lain‑lain.
Contoh Penggunaan:
Contoh ini menunjukkan cara menggunakan ChatGpt dengan menambahkan pesan ke permintaan.
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.Peningkatan
- PDF ke Gambar – Meningkatkan kinerja konversi
- PDF ke TIFF – Meningkatkan kecepatan konversi
- PDF ke Doc – Meningkatkan kinerja
Bug yang Diperbaiki
- Memperbaiki HTML ke PDF – Masalah pemformatan pada file hasil
- Memperbaiki masalah kinerja pada konversi PDF ke TIFF
- Memperbaiki HTML ke PDF – File CSS sebagai Sumber Daya Eksternal tidak diterapkan pada PDF yang dihasilkan.