Aspose

by Voodoo Editor
1 year ago
445 Views

Table of Contents


Usage of “Aspose.Pdf” Library in Voodoo RPA Studio

By adding the “Aspose.Pdf” library to VooDoo RPA Studio, you can convert your “PDF” documents to Excel(.xlsx) documents

You can download the Aspose.Pdf Library from the link here —> “DOWNLOAD via NuGeT”

Note : Libraries;

  • using Aspose.Pdf
  • using System.IO

Example #1

The Example below shows how to convert PDF file to xlsx file.

namespace VoodooImplementation {
    using System;
    using VooDooCommonData.CommonInterface;
    using VooDooCommonData.InstanceData;
    
    using Aspose.Pdf;
    using System.IO;
    
    public class ComputationEvaluator : System.MarshalByRefObject, IPlugInComputation {
        
        private bool result_;
        
        private VooDooCommonData.InstanceData.PlanDataInstanceManager planDataInstanceManager_;
        
        /// Default Constructor for class
        public ComputationEvaluator() {
        }
        
        public bool result {
            get {
                return result_;
            }
        }
        
        public virtual VooDooCommonData.InstanceData.PlanDataInstanceManager planDataInstanceManager {
            get {
                return planDataInstanceManager_;
            }
            set {
                planDataInstanceManager_ = value;
            }
        }
        
        /// Calculate
        public virtual void ExecuteComputation() {
            // address of the PDF file to be converted.
            string filePath = @"X:\...\xxx.pdf"; 
            // Address to save the converted pdf file
            string saveDirectory =@"X:\...\xxx\ "; 

            pdf2xlsx(filePath,saveDirectory); // convert pdf to xlsx
        
            result_=true;
        }
        // this function conveert pdf to excel(xlsx) using aspose.pdf library
        public void pdf2xlsx(string filePath,string savePath)
        {
            // Load PDF document
            Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(filePath);
            // convert options
            Aspose.Pdf.ExcelSaveOptions excelsave = new ExcelSaveOptions 
            { MinimizeTheNumberOfWorksheets = false, InsertBlankColumnAtFirst = false  };
            // Save the output in XLSX format
            pdfDocument.Save(Path.Combine(savePath, new FileInfo(filePath).Name + ".xlsx"), excelsave);

        }
    }
}