WebGrabber

Color
ConvertCMYKToRGB
Convert to PDF
ConvertToPDF
Debug
Debug
Digital Certificates
InvisiblySignFile
Email
AddEMail
AddEMailAttachment
AddToBcc
AddToCC
ClearEmailAttachments
ClearEMails
EMailAttachOutput
EMailReadReceipt
EMailSubject
RemoveEMail
SetEMailBody
SetRecipientInfo
SetReplyToInfo
SetSenderInfo
SetSMTPCredentials
SetSMTPInfo
FTP
AddFTPAttachment
AddFTPRequest
ClearFTPAttachments
ClearFTPs
FTPAttachOutput
RemoveFTP
SetFTPCredentials
File Output
NewDocumentName
OutputDirectory
OverwriteMethod
Flash
EmbedFlash
HTML Engine
EngineToUse
HTML Input
CreateFromHTMLText
HTMLTextToFile
URL
Headers & Footers
ClearFooterHTML
ClearHeaderHTML
FooterHeight
FooterHTML
HeaderHeight
HeaderHTML
SetPageNbrParams
Image Quality
ColorImageDownsampleThreshold
ColorImageDownsampleType
ColorImageFilter
ColorImageResolution
GrayImageDownsampleThreshold
GrayImageDownsampleType
GrayImageFilter
GrayImageResolution
MonoImageDownsampleThreshold
MonoImageDownsampleType
MonoImageFilter
MonoImageResolution
Intelligent PDF Conversion
PreserveButtons
PreserveCheckboxes
PreserveDropdowns
PreserveLinks
PreserveRadioButtons
PreserveTextboxes
Metadata
SetMetadata
Other Output Options
ASCIIEncode
PrintBackground
PDF Quality
Resolution
Page Control
AutoRotate
Orientation
PDFLength
PDFWidth
SetMargins
Proxy
ProxyPortHTTP
ProxyServerHTTP
ProxyServerPassword
ProxyServerUserName
Security (PDF)
SetPDFSecurity
SetPDFSecurity128
SetPDFSecurityAES
Security (Web)
AuthenticName
AuthenticPassword
Stamping
AddStampCollection
AddStampImage
AddStampText
ClearStampCollections
RemoveStampCollection
SetStampColor
SetStampStrokeColor
StampBackground
StampColorNET
StampFillMode
StampFont
StampFontSize
StampFontTransparency
StampRotation
StampStrokeColorNET
Timeout
Timeout
TimeoutSpan
Web View
LinearizePDF

ColorImageDownsampleThreshold

// Copyright (c) 2014 activePDF, Inc.
// Example created 04/17/14

using System;

// Make sure to add the activePDF product .NET DLL(s) to your application.
// .NET DLL(s) are typically found in the products 'bin' folder.

class Examples
{
  public static void Example()
  {
    string strPath;
    WebGrabberDK.Results.WebGrabberResult results;
    
    strPath = System.AppDomain.CurrentDomain.BaseDirectory;

    // Instantiate Object
    APWebGrabber.WebGrabber oWG = new APWebGrabber.WebGrabber();
    
    // Set the quality options for the created PDF (IE engine only)
    
    // Specifies if ASCII85 encoding should be applied to binary streams
    oWG.ASCIIEncode = true;
    
    // Automatically control the page orientation based on text flow
    oWG.AutoRotate = true;
    
    // Specifies if CMYK colors should be converted to RGB
    oWG.ConvertCMYKToRGB = true;
    
    // Set the DPI for the created PDF
    oWG.Resolution = 300.0f;
    
    // Color Image Quality Settings
    oWG.ColorImageDownsampleThreshold = 1;
    oWG.ColorImageDownsampleType = ADK.PostScript.Images.DownsampleOption.None;
    oWG.ColorImageFilter = ADK.PostScript.Images.CompressionOption.FlateEncode;
    oWG.ColorImageResolution = 72;
    
    // Gray Image Quality Settings
    oWG.GrayImageDownsampleThreshold = 1;
    oWG.GrayImageDownsampleType = ADK.PostScript.Images.DownsampleOption.None;
    oWG.GrayImageFilter = ADK.PostScript.Images.CompressionOption.FlateEncode;
    oWG.GrayImageResolution = 72;
    
    // Monochrome Image Quality Settings
    oWG.MonoImageDownsampleThreshold = 1;
    oWG.MonoImageDownsampleType = ADK.PostScript.Images.DownsampleOption.None;
    oWG.MonoImageFilter = ADK.PostScript.Images.MonochromeCompression.FlateEncode;
    oWG.MonoImageResolution = 72;
    
    // Enable extra logging (logging should only be used while troubleshooting)
    // C:\ProgramData\activePDF\Logs\
    oWG.Debug = true;
    
    // Fast web view
    oWG.LinearizePDF = true;
    
    // Time to wait for conversion to complete (in seconds)
    // 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(1.0f, 1.0f, 1.0f, 1.0f);
    
    // 0 = Portrait, 1 = Landscape
    oWG.Orientation = 0;
    
    // Rendering engine used for the HTML
    // 0 = Native, 1 = IE
    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 = "quality.pdf";
    
    // HTML to convert
    // Examples:
    // http://domain.com/path/file.aspx
    // c:\folder\file.html
    oWG.URL = "http://examples.activepdf.com/system/files/49/original/wg.html";
    
    // 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
    System.Diagnostics.Debug.WriteLine("activePDF: Done!");
  }
  
  // Error Handling
  // Error messages written to debug output
  public static void ErrorHandler(string strMethod, ADK.Results.Result results, string errorStatus)
  {
    System.Diagnostics.Debug.WriteLine("activePDF: * Error with " + strMethod);
    System.Diagnostics.Debug.WriteLine("activePDF: * " + errorStatus);
    System.Diagnostics.Debug.WriteLine("activePDF: * " + results.Details);
    if (results.Origin.Function != strMethod)
    {
      System.Diagnostics.Debug.WriteLine("activePDF: * " + results.Origin.Class + "." + results.Origin.Function);
    }
    if (results.ResultException != null)
    {
      // To view the stack trace on an exception uncomment the line below
      // System.Diagnostics.Debug.WriteLine("activePDF: " + results.ResultException.StackTrace);
    }
  }
}

Copyright © 2014 activePDF, Inc