حقول الأزرار والصور
Contents
[
Hide
]
مثال Java في FormExamples.addImageAppearanceToButtonField(...) يُظهر كيفية تحديث مظهر حقل الزر باستخدام تدفق صورة.
سير العمل بسيط:
- ربط ملف PDF الإدخال بـ
form.bindPdf(...) - افتح ملف الصورة باستخدام
Files.newInputStream(...) - اتصال
form.fillImageField(...)لحقل الزر - حفظ ملف PDF المحدث
public static void addImageAppearanceToButtonField(Path inputFile, Path imageFile, Path outputFile) throws Exception {
Form form = new Form();
try (InputStream imageStream = Files.newInputStream(imageFile)) {
form.bindPdf(inputFile.toString());
form.fillImageField("Image1_af_image", imageStream);
form.save(outputFile.toString());
} finally {
form.close();
}
}