Exemplo n.º 1
0
 private void btnBrowseForOpen_Click(object sender, EventArgs e)
 {
     PDFXEdit.IAFS_NamesCollection openFiles = mainFrm.ShowOpenFilesDlg(false, "PDF Documents (*.pdf)|*.pdf|All Files (*.*)|*.*");
     if (openFiles == null)
     {
         return;
     }
     PDFXEdit.IAFS_Name fileName = openFiles[0];
     tSrcToOpen.Text = fileName.FileSys.NameToString(fileName);
     mainFrm.AllowRunOper(IsValid());
 }
Exemplo n.º 2
0
        public void ExtractDocToTiff(object obj)
        {
            try
            {
                stData data = (stData)obj;

                var importCV                    = FindNeededImportConverter(Path.GetExtension(data.sDoc));
                PDFXEdit.IAFS_Name name         = m_fsInst.DefaultFileSys.StringToName(data.sDoc);
                int openFileFlags               = (int)(PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_Read | PDFXEdit.AFS_OpenFileFlags.AFS_OpenFile_ShareRead);
                PDFXEdit.IAFS_File     destFile = m_fsInst.DefaultFileSys.OpenFile(name, openFileFlags);
                PDFXEdit.IPXC_Document Doc      = importCV.Convert(m_Inst, destFile);

                //PDFXEdit.IPXC_Document Doc = m_pxcInst.OpenDocumentFromFile(data.sDoc, null);
                PDFXEdit.IOperation Op    = m_Inst.CreateOp(m_nID);
                PDFXEdit.ICabNode   input = Op.Params.Root["Input"];
                input.Add().v             = Doc;
                PDFXEdit.ICabNode options = Op.Params.Root["Options"];
                options["PagesRange.Type"].v  = "All";
                options["DestFolder"].v       = data.sFolder;           //Output folder
                options["ExportMode"].v       = "AllToMutliPage";
                options["Zoom"].v             = 150;
                options["ShowResultFolder"].v = data.bLast;                 //We'll show the result folder only when we'll work with last doc
                //Saving as tiff
                PDFXEdit.ICabNode fmtParams = options["FormatParams"];
                //Compression type
                fmtParams["COMP"].v = 5;                 //LZW compression
                //X DPI
                fmtParams["DPIX"].v = 150;
                //Y DPI
                fmtParams["DPIY"].v = 150;
                //Image format
                fmtParams["FMT"].v = PDFXEdit.IXC_ImageFileFormatIDs.FMT_TIFF_ID; //TIFF
                //Image type
                fmtParams["ITYP"].v = 16;                                         //24 TrueColor
                //Use Predictor
                fmtParams["PRED"].v = 1;                                          //Yes
                //Thumbnail
                fmtParams["ITYP"].v = 0;                                          //No
                Op.Do();
                Doc.Close();
                m_nSavedFilesCount++;
                if (m_nSavedFilesCount == m_aFiles.Count)
                {
                    MessageBox.Show("Export completed");
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }