ฉันจะเพิ่มรูปภาพลงในไฟล์ PDF ได้อย่างไร

ฉันได้ลองใช้โค้ดตัวอย่างออนไลน์มากมาย แต่ไม่รู้ว่าจะนำรูปภาพไปใช้กับไฟล์ Itext PDF ได้อย่างไร ใครก็ได้โปรดช่วยฉันหน่อยได้ไหม?

ขอบคุณ.


person Vinieus    schedule 25.03.2019    source แหล่งที่มา
comment
คุณใช้ iText เวอร์ชันใด   -  person Uladzimir Asipchuk    schedule 26.03.2019


คำตอบ (1)


นี่คือวิธีแก้ปัญหาสำหรับเช็คนั้น

Document document = new Document();
        PdfWriter.getInstance(document, new FileOutputStream("sample2.pdf"));
        document.open();
        Image img = Image.getInstance("arvind-rai.png");
        img.setAbsolutePosition(450f, 10f);
        document.add(img);
        document.close();
person Jignesh    schedule 25.03.2019