Пример #1
0
        static public int RemoveAttachment(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                return(0);
            }

            if (Parent.AttachmentView.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select attachment from the Attachments list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            Form1.ListItemAttachment currentAnnot = Parent.AttachmentView.SelectedItems[0] as Form1.ListItemAttachment;
            if (currentAnnot.SubItems[currentAnnot.SubItems.Count - 1].Text == "Embedded File Item")
            {
                IPXC_NameTree attachments = Parent.m_CurDoc.GetNameTree("EmbeddedFiles");
                attachments.Remove(currentAnnot.SubItems[0].Text);
                return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations);
            }
            IPXC_Pages pages = Parent.m_CurDoc.Pages;
            IPXC_Page  page  = pages[(uint)(currentAnnot.m_nPageNumber)];

            page.RemoveAnnots((uint)currentAnnot.m_nIndexOnPage, 1);

            Marshal.ReleaseComObject(page);
            Marshal.ReleaseComObject(pages);


            return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations);
        }
Пример #2
0
        static public int ChangeAttachmentsDescription(Form1 Parent)
        {
            if (Parent.m_CurDoc == null)
            {
                return(0);
            }

            if (Parent.AttachmentView.SelectedItems.Count == 0)
            {
                MessageBox.Show("Please select attachment from the Attachments list.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return(0);
            }

            Form1.ListItemAttachment currentAnnot = Parent.AttachmentView.SelectedItems[0] as Form1.ListItemAttachment;
            if (currentAnnot.SubItems[currentAnnot.SubItems.Count - 1].Text == "Embedded File Item")
            {
                IPXC_NameTree   attachments = Parent.m_CurDoc.GetNameTree("EmbeddedFiles");
                IPXS_PDFVariant pdfVariant  = attachments.Lookup(currentAnnot.SubItems[0].Text);
                IPXC_FileSpec   fileSpec    = Parent.m_CurDoc.GetFileSpecFromVariant(pdfVariant);
                fileSpec.Description = "Description";
                Marshal.ReleaseComObject(attachments);

                return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations);
            }
            IPXC_Pages      pages           = Parent.m_CurDoc.Pages;
            IPXC_Annotation annotFileAttach = pages[(uint)currentAnnot.m_nPageNumber].GetAnnot((uint)currentAnnot.m_nIndexOnPage);
            IPXC_AnnotData_FileAttachment fileAttachment = annotFileAttach.Data as IPXC_AnnotData_FileAttachment;
            IPXC_FileSpec annotAttachFileSpec            = fileAttachment.FileAttachment;

            annotAttachFileSpec.Description = "Description";

            return((int)Form1.eFormUpdateFlags.efuf_Attachments | (int)Form1.eFormUpdateFlags.efuf_Annotations);
        }