static public int InsertPagesFromOtherDocument(Form1 Parent)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter          = "PDF Documents (*.pdf)|*.pdf|All Files (*.*)|*.*";
            ofd.DefaultExt      = "pdf";
            ofd.FilterIndex     = 1;
            ofd.CheckPathExists = true;
            IPXC_Document srcDoc = null;

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                srcDoc = Parent.m_pxcInst.OpenDocumentFromFile(ofd.FileName, null);
            }
            if (srcDoc == null)
            {
                return(0);
            }
            if (Parent.m_CurDoc == null)
            {
                Document.OpenDocFromStringPath(Parent);
            }
            IPXC_Pages pages = Parent.m_CurDoc.Pages;

            pages.InsertPagesFromDoc(srcDoc, 0, 0, 1, (int)PXC_InsertPagesFlags.IPF_Annots_Copy | (int)PXC_InsertPagesFlags.IPF_Widgets_Copy);
            Marshal.ReleaseComObject(pages);
            return((int)Form1.eFormUpdateFlags.efuf_All);
        }
示例#2
0
        static public int CreateNewDoc(Form1 Parent)
        {
            IPXC_Document coreDoc = Parent.m_pxcInst.NewDocument();
            PXC_Rect      rc;

            rc.left   = 0;
            rc.right  = 600;
            rc.top    = 800;
            rc.bottom = 0;
            IPXC_UndoRedoData urd;
            IPXC_Pages        pages = coreDoc.Pages;

            pages.AddEmptyPages(0, 1, ref rc, null, out urd);
            Parent.CloseDocument();
            Parent.m_CurDoc = coreDoc;
            Marshal.ReleaseComObject(pages);
            return((int)Form1.eFormUpdateFlags.efuf_All);
        }
示例#3
0
 public void AuthDoc(IPXC_Document pDoc, uint nFlags)
 {
     //If this method is called then the document is protected
     pDoc.AuthorizeWithPassword("111");
 }
示例#4
0
        private void Redraw_PDF()
        {
            ProgressBar1 prBar = new ProgressBar1();

            try
            {
                prBar.Show();
                prBar.Refresh();
                int Rect_size_for_20 = page_Width / 22;
                if (workspace_ob.op.orientation_of_document == 0)
                {
                    Rect_size = (page_Width) / (workspace_ob.field_ex.width + 2);
                }
                else
                {
                    Rect_size = (page_Height) / (workspace_ob.field_ex.heigth + 2);
                }
                height     = workspace_ob.field_ex.heigth;
                width      = workspace_ob.field_ex.width;
                keys_count = workspace_ob.keys.Count;

                int nID = axPXV_Control1.Inst.Str2ID("op.document.insertEmptyPages", false); //Create new "InsertEmptyPages" operation iD
                PDFXEdit.IOperation pOp   = axPXV_Control1.Inst.CreateOp(nID);               //Create new operation
                PDFXEdit.ICabNode   input = pOp.Params.Root["Input"];                        //Create "Input" id to current operation
                IPXC_Document       pDoc  = axPXV_Control1.Doc.CoreDoc;

                input.v = pDoc;                                         //Specify that working with current document
                PDFXEdit.ICabNode options = pOp.Params.Root["Options"]; //Create "Option" id to current operation
                options["PaperType"].v = 2;                             //Apply custom paper type

                if (workspace_ob.op.orientation_of_document == 0)
                {
                    options["Width"].v  = 800;
                    options["Height"].v = 1200;
                }
                else
                {
                    options["Width"].v  = 1200;
                    options["Height"].v = 800;
                }
                pOp.Do();                                                               //Applying creation new pages
                nID     = axPXV_Control1.Inst.Str2ID("op.document.deletePages", false); //Create new "deletePages" operation id
                pOp     = axPXV_Control1.Inst.CreateOp(nID);                            //Create new operation
                input   = pOp.Params.Root["Input"];                                     //Create "Input" id to current operation
                input.v = pDoc;                                                         //Specify that working with current document
                options = pOp.Params.Root["Options"];                                   //Create "Option" id to current operation
                options["PagesRange.Custom"].v = 0;                                     //Specify range of deleting pages. In this case it is just one zeroth page
                pOp.Do();                                                               //Applying deletion range of pages

                var page = axPXV_Control1.Doc.CoreDoc.Pages[0];                         //Create handler to first page
                var CC   = axPXV_Control1.Doc.CoreDoc.CreateContentCreator();           //Create "Content Creator" for drawing on page.

                if (workspace_ob.op.orientation_of_document == 0)
                {
                    Redraw_field_vertical(width, height, CC, page);
                    Draw_Keys_Vartical(ref CC, ref page);
                }
                else if (workspace_ob.op.orientation_of_document == 1)
                {
                    Redraw_field_horisontal(width, height, CC, page);
                    Draw_Keys_Horisontal(ref CC, ref page);
                }
                CC.SetLineWidth(0.5); //Set line  width
                CC.StrokePath(true);  //Set end of drawing current element

                nID     = axPXV_Control1.Inst.Str2ID("op.document.resizePages", false);
                pOp     = axPXV_Control1.Inst.CreateOp(nID);
                input   = pOp.Params.Root["Input"];
                input.v = pDoc;
                options = pOp.Params.Root["Options"];
                options["PaperType"].v             = 2; //Document values table
                options["StdPaperIndex"].v         = 4; //A2
                options["ScalePage"].v             = true;
                options["ConstraintProportions"].v = true;
                options["PagesRange.Filter"].v     = 1;
                if (workspace_ob.op.orientation_of_document == 1)
                {
                    options["Width"].v  = 841.89;
                    options["Height"].v = 595.276;
                }
                pOp.Do();
                prBar.Hide();
                prBar.Refresh();
            }
            catch
            {
                MessageBox.Show("Generate PDF again.");
                prBar.Hide();
                prBar.Refresh();
                return;
            }
            prBar.Hide();
            prBar.Refresh();
        }