示例#1
0
    public void ThreadProc(Object stateInfo)
    {
        Console.WriteLine("starting job {0}", (int)stateInfo);
        DfvObj.Initialize();
        DfvObj adfv           = null;
        string inputFilename  = _inputdoc;
        string outputFilename = inputFilename + ".pdf";

        try
        {
            adfv                = new DfvObj();
            adfv.DocumentURI    = inputFilename;
            adfv.OutputFilePath = outputFilename;
//			adfv.PrinterName = "@SVG";
            adfv.PrinterName = "@PDF";
            adfv.ExitLevel   = 4;
            adfv.Execute();

            ArrayList errList = new ArrayList();
            adfv.GetFormattingError(errList);
            for (int i = 0; i < errList.Count; i++)
            {
                DfvErrorInformation ei = (DfvErrorInformation)errList[i];
                Console.WriteLine("ErrorLevel : " + ei.ErrorLevel + "\nErrorCode  : " +
                                  ei.ErrorCode + "\n" + ei.ErrorMessage);
            }

            Console.WriteLine("\nFormatting finished: '" + outputFilename + "' created.");
        }
        catch (DfvException e)
        {
            Console.WriteLine("ErrorLevel : " + e.ErrorLevel + "\nErrorCode : " + e.ErrorCode + "\n" + e.Message);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.Message);
        }
        finally
        {
            if (adfv != null)
            {
                adfv.Dispose();
            }
            DfvObj.Terminate();
            Console.WriteLine("finishing job {0}", (int)stateInfo);
            _doneEvent.Set();
        }
    }
示例#2
0
    public void ThreadProc(Object stateInfo)
    {
        Console.WriteLine("starting job {0}", (int)stateInfo);
        DfvObj.Initialize();
        DfvObj adfv = null;
        string inputFilename = _inputdoc;
        string outputFilename = inputFilename + ".pdf";
        try
        {
            adfv = new DfvObj();
            adfv.DocumentURI = inputFilename;
            adfv.OutputFilePath = outputFilename;
        //			adfv.PrinterName = "@SVG";
            adfv.PrinterName = "@PDF";
            adfv.ExitLevel = 4;
            adfv.Execute();

            ArrayList errList = new ArrayList();
            adfv.GetFormattingError(errList);
            for (int i = 0; i < errList.Count; i++)
            {
                DfvErrorInformation ei = (DfvErrorInformation)errList[i];
                Console.WriteLine("ErrorLevel : " + ei.ErrorLevel + "\nErrorCode  : " +
                ei.ErrorCode + "\n" + ei.ErrorMessage);
            }

            Console.WriteLine("\nFormatting finished: '" + outputFilename + "' created.");
        }
        catch(DfvException e)
        {
            Console.WriteLine("ErrorLevel : " + e.ErrorLevel + "\nErrorCode : " + e.ErrorCode + "\n" + e.Message);
        }
        catch(Exception e)
        {
            Console.WriteLine(e.Message);
        }
        finally
        {
            if (adfv != null)
                adfv.Dispose();
            DfvObj.Terminate();
            Console.WriteLine("finishing job {0}", (int)stateInfo);
            _doneEvent.Set();
        }
    }