• I mostly interested in deleting all annotations as a clear function.
    I am looking for a way to allow the document to be saved without any annotations.
    The annotations will mostly be used for my users own purposes but they want to send it to someone else without the annotations.

    • Offizieller Beitrag

    Hello,

    I can see this option:
    - delete annotation, the current version now can do this - see demo
    - send the original, unmodified file (keep it in app)
    - save PDF without any annotations - use command to COMPDF_SetSaveMode

    COMPDF_SetSaveMode = 613; // Set the save mode - also see COMPDF_Ann_SetAnnotSaveMode
    // It is possible to use this bits:
    // 1: Remove the Annots except for Hyperlinks. Ommits "AcroForm"
    // 2: Remove the Hyperlinks
    // 4: Remove the Bookmarks
    // 8: Remove the StructElements
    // 16: Remove Transition Effects
    // 32: remove Page AA Actions
    // 64: remove PDFA flag
    // 128: Delete Extra XML Data
    // 256: Delete extra commands (such as images and DrawObjects)
    // 512: Delete named destinations
    // 1024: DO not create PDF A Marker
    // 2048: DO always create PDF A Marker
    // 4096: Do not save modified page sizes
    // 8192: Never write Cropbox parameter

  • I haven't been able to work on this for a while but I am confused now by your last reply.
    Because with this line of code added:
    wpViewPDF1.Command(COMPDF_Ann_SetAnnotSaveMode, 1); //Annotations are saved in the PDF

    This is how I get annotations to actually be in the saved PDF if new annotations have been added to the PDF.
    If I remove the line I get no NEW annotations saved in the PDF but the old ones remain.
    This seems to be opposite of what your last reply implies.

    But at any rate I am trying to remove all annotations from a PDF that has been saved and is now being re-opened. In case that wasn't clear.

    • Offizieller Beitrag
    Zitat

    This is how I get annotations to actually be in the saved PDF if new annotations have been added to the PDF.
    If I remove the line I get no NEW annotations saved in the PDF but the old ones remain.
    This seems to be opposite of what your last reply implies.

    Usually annotations loaded from PDF are not touched. They will not automatically be converted into movable objects.

    If the PDF file is saved, it is possible to remove all annotations (and other items) by using the COMPDF_SetSaveMode command with several flags.

    If, and only if, the annotations are converted into objects they can be moved, changed and deleted. New annotations can be added.

    This is done in PDFEdit.exe (and the example projects)

    // Make sure the annotations work interactively!
    newTab.wpviewpdf.Command(COMPDF_ACRO_MAKEDRAWOBJ,'',0); // 0=all Annots!

    The modifications will only be saved after
    wpViewPDF1.Command(COMPDF_Ann_SetAnnotSaveMode, 1);