مدیریت حاشیه نویسی در PDF با Java

مدرن Java کتابخانه برای مدیریت حاشیه نویسی پی دی اف با استفاده از API های ما.

نحوه مدیریت حاشیه نویسی با استفاده از Java کتابخانه

به منظور اضافه کردن متن حاشیه نویسی، ما از API Aspose.PDF for Java استفاده خواهیم کرد که یک API تبدیل قدرتمند و آسان برای استفاده برای پلت فرم جاوا است. می توانید آخرین نسخه آن را مستقیماً از MAVEN بارگیری کرده و با افزودن تنظیمات زیر به pom.xml، آن را در پروژه مبتنی بر Maven خود نصب کنید.

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>

ایجاد حاشیه نویسی در سند پی دی اف از طریق Java


شما نیاز به Aspose.PDF for Java به سعی کنید کد در محیط شما.

۱. بارگذاری PDF در نمونه ای از کلاس سند. ۱. حاشیه نویسی ایجاد کنید که می خواهید به PDF اضافه کنید. ۱. حاشیه نویسی را به مجموعه حاشیه نویسی آبجکت Page اضافه کنید. ۱. فایل 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");