عمليات الصور
Contents
[
Hide
]
Java الحالية الفئة PdfContentEditorExamples تدعم مباشرة replaceImage(...).
استبدال صورة
- اربط ملف PDF المصدر بـ واجهة
PdfContentEditor. - استدعِ
replaceImage(...)مع رقم الصفحة، فهرس الصورة، ومسار صورة الاستبدال. - احفظ مستند PDF المحدث.
public static void replaceImage(Path inputFile, Path imageFile, Path outputFile) {
PdfContentEditor editor = new PdfContentEditor();
try {
editor.bindPdf(inputFile.toString());
editor.replaceImage(1, 1, imageFile.toString());
editor.save(outputFile.toString());
} finally {
editor.close();
}
}