จัดการคำอธิบายประกอบใน PDF ด้วย Java

โมเดิร์น Java ห้องสมุดสำหรับการจัดการคำอธิบายประกอบ PDF โดยใช้ API ของเรา

วิธีการจัดการคำอธิบายประกอบโดยใช้ห้องสมุด Java

เพื่อที่จะเพิ่มคำอธิบายประกอบข้อความเราจะใช้ Aspose.PDF for Java API ซึ่งเป็นคุณลักษณะที่อุดมไปด้วยที่มีประสิทธิภาพและง่ายต่อการใช้ API แปลงสำหรับแพลตฟอร์ม java Javaคุณสามารถดาวน์โหลดรุ่นล่าสุดได้โดยตรงจาก Maven และติดตั้งภายในโครงการ Maven ตามของคุณโดยการเพิ่มการกำหนดค่าต่อไปนี้เพื่อpom.xml

Repository

<repository>
    <id>AsposeJavaAPI</id>
    <name>Aspose Java AP</name>
    <url>https://releases.aspose.com/java/repo/</url>
</repository>

Dependency

<dependency>
<groupId>com.aspose</groupId>
<artifactId>aspose-pdf</artifactId>
<version>version of aspose-pdf API</version>
</dependency>

สร้างคำอธิบายประกอบในเอกสาร PDF ผ่าน Java


คุณจำเป็นต้อง Aspose.PDF for Java เพื่อลองรหัสในสภาพแวดล้อมของคุณ

1.โหลดรูปแบบไฟล์ PDF ในตัวอย่างของการเรียนเอกสาร 1.สร้างคำอธิบายประกอบที่คุณต้องการเพิ่มลงใน PDF 1.เพิ่มคำอธิบายประกอบไปยังคอลเลกชันคำอธิบายประกอบวัตถุหน้าของ 1.บันทึกไฟล์ PDF

PDF ข้อความหมายเหตุ - Java

Example: Java


    Document document = new Document(_dataDir + "sample.pdf");
    Page page = document.getPages().get_Item(1);
    Rectangle rect = new Rectangle(200, 750, 400, 790);
    TextAnnotation textAnnotation = new TextAnnotation(page, rect);

    textAnnotation.setTitle("Aspose User");
    textAnnotation.setSubject("Sample Subject");
    textAnnotation.setState (AnnotationState.Accepted);
    textAnnotation.setContents("Sample contents for the annotation");
    textAnnotation.setOpen(true);
    textAnnotation.setIcon(TextIcon.Circle);

    Border border = new Border(textAnnotation);
    border.setWidth(5);
    border.setDash(new Dash(1, 1));
    textAnnotation.setBorder(border);
    textAnnotation.setRect(rect);

    page.getAnnotations().add(textAnnotation);
    document.save(_dataDir + "sample_textannot.pdf");