Пример #1
0
    public static void Example()
    {
        string strPath;

        WebGrabberDK.Results.WebGrabberResult results;

        strPath = System.AppDomain.CurrentDomain.BaseDirectory;

        // Instantiate Object
        APWebGrabber.WebGrabber oWG = new APWebGrabber.WebGrabber();

        // C:\ProgramData\activePDF\Logs\
        oWG.Debug = true;

        oWG.LinearizePDF = true;

        // Set the amount of time before a request will time out
        oWG.TimeoutSpan = new TimeSpan(0, 0, 40);

        // Margins (Top, Bottom, Left, Right) 1.0 = 1"
        oWG.SetMargins(0.75f, 0.75f, 0.75f, 0.75f);

        // 0 = Portrait, 1 = Landscape
        oWG.Orientation = 0;

        // Rendering engine used for the HTML
        oWG.EngineToUse = APWebGrabberInterface.ConversionEngine.IE;

        // Convert the HTML background (IE engine only)
        oWG.PrintBackground = true;

        // PDF output location and filename
        oWG.OutputDirectory = strPath;
        oWG.NewDocumentName = "basic.pdf";

        // HTML to convert
        // Examples:
        // http://domain.com/path/file.aspx
        // c:\folder\file.html
        oWG.URL = "http://examples.activepdf.com/samples/doc";

        // Perform the HTML to PDF conversion
        results = oWG.ConvertToPDF();
        if (results.WebGrabberStatus != WebGrabberDK.Results.WebGrabberStatus.Success)
        {
            ErrorHandler("ConvertToPDF", results, results.WebGrabberStatus.ToString());
        }

        // Release Object
        oWG = null;

        // Process Complete
        WriteResults("Done!");
    }
Пример #2
0
    public static void Example()
    {
        WebGrabberDK.Results.WebGrabberResult results;

        // Instantiate Object
        APWebGrabber.WebGrabber oWG = new APWebGrabber.WebGrabber();

        results = oWG.ConvertToPDF();
        if (results.WebGrabberStatus != WebGrabberDK.Results.WebGrabberStatus.Success)
        {
            ErrorHandler("ConvertToPDF", results, results.WebGrabberStatus.ToString());
        }

        // Release Object
        oWG = null;

        // Process Complete
        WriteResults("Done!");
    }