Spooler 2017

FormName

<!-- Copyright (c) 2018 ActivePDF, Inc. -->
<!-- ActivePDF Spooler 2017 -->
<!-- Example generated 06/23/18  -->

<!-- Example uses the .NET DLL which requires -->
<!-- Coldfusion 8 or above -->

<CFSCRIPT>
// Get current path
strPath = ExpandPath(".") & "\";


// Instantiate Object
oSP = CreateObject(".NET", "APSpoolerNET.Spooler", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");

// Use the PrintJobProfile object to set specific printer settings
// for the print job if the default options are not what is needed.
oPJP = oSP.PrintJobProfile("SettingsOne");

oPJP.Set_BinSource(15);
oPJP.Set_Collate(false);
enumColorMode = CreateObject(".NET", "APSpoolerNET.ColorMode", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_ColorMode(enumColorMode.Color);
oPJP.Set_DPI(300);
enumDuplexMode = CreateObject(".NET", "APSpoolerNET.DuplexMode", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_Duplex(enumDuplexMode.Simplex);
oPJP.Set_FormName("SampleForm");
oPJP.Set_Nup(0);
enumOrientation = CreateObject(".NET", "APSpoolerNET.Orientation", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_Orientation(enumOrientation.Portrait);
enumPaperSize = CreateObject(".NET", "APSpoolerNET.PaperSize", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_PaperSize(enumPaperSize.Letter);
oPJP.Set_PrinterName("Microsoft Print to PDF");
enumPrintPages = CreateObject(".NET", "APSpoolerNET.PrintPages", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_PrintOddEvenAll(enumPrintPages.AllPages);
oPJP.Set_ProfileName("SettingsOne");
enumPrintScaling = CreateObject(".NET", "APSpoolerNET.PrintScaling", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_Scaling(enumPrintScaling.Custom);
oPJP.Set_CustomScaling(95.0);
enumTrueTypeOptions = CreateObject(".NET", "APSpoolerNET.TrueTypeOptions", "C:\Program Files\ActivePDF\Spooler\bin\APSpoolerNET.dll");
oPJP.Set_TrueTypeOption(enumTrueTypeOptions.Substitute);

// File specific settings
oSP.Set_Copies(1);
oSP.Set_PageRange("1-2,4");
oSP.Set_PrintAnnotations(true);

// Print a PDF
results = oSP.PrintFile(oPJP, strPath & "5pageLI.pdf");
if(results.Get_SpoolerStatus() != "Success") {
  Error("PrintFile", results, results.Get_SpoolerStatus());
}

// Release Object
oSP = 0;

// Process Complete
WriteOutput("Done!");

// Error Handling
Function Error(method, oResults, errorStatus) {
  WriteOutput("Error with " & method & ": <br/>"
    & errorStatus &  "<br/>"
    & oResults.Get_details());
}
</CFSCRIPT>

Copyright © 2018 ActivePDF, Inc