Documents for PDF .NET Edition
GrapeCity Documents PDF Viewer / Edit PDF / Features / Copy and Paste
In This Topic
    Copy and Paste
    In This Topic

    The Annotation and Form Editor in GcDocs PDF Viewer allows you to copy and paste existing annotations or form fields respectively. The ‘Clone’ button in the property panel creates an exact copy of the annotation or form field at the same location on the same page. The position and other properties of a cloned field can be changed in the property panel.

    For example, while creating a PDF form, you can clone a form field and change its 'X' property to align it horizontally or 'Y' property to align it vertically with the original field.

    Clone annotations or form fields in PDF viewer

    Note: The cloned annotation or form field has a new id and field name.

    Using Keyboard Shortcuts

    The copy and paste operation can also be performed by using keyboard shortcuts:

    The annotations and form fields can be pasted on the same page, different page or even in another PDF document. When keyboard shortcut (Ctrl+V) is used for the paste action, the cloned field is always placed in the center of a page. You can also use the context menu options by right clicking the field. Once cut or copied, the field can be pasted by right clicking and using 'Paste' option from context menu.


    Clone annotations or form fields in PDF viewer by using keyboard shortcuts

    Using Code

    To add a cloned annotation or form field to a PDF document using code:

    Copy Code
    //Find field widget with name field1
    const resultData = await viewer.findAnnotations("field1", { findField: 'fieldName' });
    //Clone field
    const clonedField = viewer.cloneAnnotation(resultData[0].annotation);
    //Change field name property
    clonedField.fieldName = "field1Copy";
    //Add cloned field to the second page
    viewer.addAnnotation(1, clonedField);