How to call PCL to PDF Converter SDK from C# source code?

PCL to PDF Converter SDK can be downloaded from following web page,

http://www.verypdf.com/app/pcl-converter/try-and-buy.html
http://www.verypdf.com/pcltools/pcltoolsdk.zip

PCL to PDF Converter SDK is support all options which included in PCL to PDF Converter Command Line product, please refer to the supported options at below,

C:\>"C:\Program Files (x86)\VeryPDF PCL Converter v2.6\pcltool.exe"
VeryPDF PCL Converter v2.6
Web:
http://www.verypdf.com
mailto:support@verypdf.com
-------------------------------------------------------
Description:
Convert *.PCL and *.PXL files to PDF, PS, TIFF, JPEG, BMP, PCX, PXL etc. files
Release Date: May 28 2012
Usage: pcltool [options] <pcl-file> [<pdf-file>]
  -width <int>               : Set page width to image file
  -height <int>              : Set page height to image file
  -xres <int>                : Set X resolution to image file
  -yres <int>                : Set Y resolution to image file
  -bitcount <int>            : Set color depth for image conversion
  -rotate <int>              : Rotate pages, 90, 180, 270
  -view                      : View PDF file after creation
  -append <int>              :
        -append 0: Overwrite if PDF file exists
        -append 1: Insert before first page if PDF file exists
        -append 2: Append to last page if PDF file exists
        -append 3: Rename filename if PDF file exists
  -producer <string>         : Set 'producer' to PDF file
  -creator <string>          : Set 'creator' to PDF file
  -subject <string>          : Set 'subject' to PDF file
  -title <string>            : Set 'title' to PDF file
  -author <string>           : Set 'author' to PDF file
  -keywords <string>         : Set 'keywords' to PDF file
  -openpwd <string>          : Set 'open password' to PDF file
  -ownerpwd <string>         : Set 'owner password' to PDF file
  -keylen <int>              : Key length (40 or 128 bit)
        -keylen 0:  40 bit RC4 encryption (Acrobat 3 or higher)
        -keylen 1: 128 bit RC4 encryption (Acrobat 5 or higher)
        -keylen 2: 128 bit RC4 encryption (Acrobat 6 or higher)
  -encryption <int>          : Restrictions
        -encryption    0: Encrypt the file only
        -encryption 3900: Deny anything
        -encryption    4: Deny printing
        -encryption    8: Deny modification of contents
        -encryption   16: Deny copying of contents
        -encryption   32: No commenting
        ===128 bit encryption only -> ignored if 40 bit encryption is used
        -encryption  256: Deny FillInFormFields
        -encryption  512: Deny ExtractObj
        -encryption 1024: Deny Assemble
        -encryption 2048: Disable high res. printing
        -encryption 4096: Do not encrypt metadata
  -bookmark <int>            : Create bookmark to PDF file
        -bookmark 1: Use short filename as bookmarks
        -bookmark 2: Use full filename as bookmarks
        -bookmark 3: Use short filename without suffix as bookmarks
  -mergepdf <string>         : Merge two PDF files into one PDF file
        -mergepdf "file1|file2|file3|...": Merge several PDF files into one
        -mergepdf "C:\filelist.txt": Merge PDF files from a .txt file
        -mergepdf "C:\test.pdf*100-200*250-300": Extract page ranges from PDF file
        -mergepdf "C:\*.pdf": Merge PDF files into one PDF file
  -burstpdf <string>         : Burst PDF file into single page PDF files
  -fontfolder <string>       : Set font folder for PCL conversion
  -pclcmd <string>           : Set additional PCL options
  -noempty                   : Delete empty pages from PDF file
  -raster                    : Convert PCL file to Raster PDF file
  -raster2 <int>             : Convert PCL file to Raster PDF file by pcl5e.exe
  -quality <int>             : Set quality for JPEG, JPEG2000 compression
  -colorimg <int>            : Set compression method for color image
       -colorimg 0: no change compression for color image file
       -colorimg 1: compress color image file with JPEG arithmetic
       -colorimg 2: compress color image file with JPEG2000 arithmetic
  -template <string>         : Overlay template PDF file on all pages
  -templatefirst <string>    : Overlay template PDF file on page #1
  -templatefollowing <string>: Overlay template PDF file on page #2,#3,...,#end
  -templateatbottom          : Set template PDF page at bottom
  -mapfont <string>          : Map fonts by mapfont.ini file
  -embedfonts <string>       : Embed mapped fonts into PDF file, yes or no
  -multiduplex               : Insert blank pages after 'duplex' pages automatically
  -barcodetext <string>      : Barcode text contents, support mask characters,
       #: a decimal digit (0 – 9)
       ?: any printable characters
      -barcodetext *####################*
      -barcodetext *#??????????????????#*
  -barcodefont <string>      : Render Barcode with TrueType font
  -v                         : Print copyright and version info
  -h                         : Print usage information
  -help                      : Print usage information
  --help                     : Print usage information
  -?                         : Print usage information
  -$ <string>                : Input registration key
Example:
   pcltool.exe C:\in.pcl C:\out.pdf
   pcltool.exe C:\in.pcl C:\out.ps
   pcltool.exe -pclcmd "\"-J@PJL SET PAPER=A3\"" C:\in.pcl C:\out.pdf
   pcltool.exe -pclcmd "\"-J@PJL SET PAPER=A4\"" C:\in.pcl C:\out.pdf
   pcltool.exe -pclcmd "\"-J@PJL SET PAPER=Ledger\"" C:\in.pcl C:\out.pdf
   pcltool.exe -pclcmd "\"-J@PJL SET PAPER=Letter\"" C:\in.pcl C:\out.pdf
   pcltool.exe -pclcmd "\"-J@PJL SET PAPER=A4\" \"-J@PJL SET DEFAULT ORIENTATION = LANDSCAPE\"" C:\in.pcl C:\out.pdf
   pcltool.exe C:\*.pcl C:\*.pdf
   pcltool.exe -append 2 C:\*.pcl C:\out.pdf
   pcltool.exe -append 2 C:\*.pxl C:\out.pdf
   pcltool.exe C:\filelist.txt C:\out.pdf
   pcltool.exe -xres 200 -yres 200 C:\in.pcl C:\out.pcx
   pcltool.exe -append 1 C:\in.pcl C:\out.pdf
   pcltool.exe -append 2 C:\in.pcl C:\out.pdf
   pcltool.exe -subject "subject" C:\in.pcl C:\out.pdf
   pcltool.exe -ownerpwd owner -keylen 2 -encryption 3900 C:\in.pcl C:\out.pdf
   pcltool.exe -bookmark 3 C:\in.pxl C:\out.pdf
   pcltool.exe -mergepdf "C:\1.pdf|C:\2.pdf|C:\3.pdf" C:\out.pdf
   pcltool.exe -mergepdf "C:\*.pdf" C:\out.pdf
   pcltool.exe -mergepdf "C:\filelist.txt" C:\out.pdf
   pcltool.exe -mergepdf "C:\test-extraction.pdf*10-15 C:\out10-15.pdf
   pcltool.exe -mergepdf "C:\test-extraction.pdf*500-501 C:\out500-501.pdf
   pcltool.exe -burstpdf "C:\test.pdf" C:\out.pdf
   pcltool.exe -rotate 90 C:\in.pcl C:\out.pdf
   pcltool.exe -rotate 90 C:\in.pcl C:\out.tif
   pcltool.exe -raster C:\in.pcl C:\out.pdf
   pcltool.exe -width 800 -height 600 C:\in.pcl C:\out.tif
   pcltool.exe C:\in.pcl "C:\out %04d.tif"
   pcltool.exe C:\in.pcl "C:\out put%d.jpg"
   pcltool.exe -templatefirst temp1.pdf -templatefollowing temp2.pdf test.pcl test.pdf
   pcltool.exe -template temp.pdf test.pcl test.pdf
   pcltool.exe -templateatbottom -template temp.pdf test.pcl test.pdf
   pcltool.exe -mapfont "mapfont.ini" C:\in.pcl C:\out.pdf
   pcltool.exe -mapfont default C:\in.pcl C:\out.pdf
   pcltool.exe -mapfont "C:\mapfont.ini" C:\in.pcl C:\out.pdf
   pcltool.exe -mapfont "C:\mapfont.ini" -embedfonts yes C:\in.pcl C:\out.pdf
   pcltool.exe -mapfont "C:\mapfont.ini" -embedfonts no C:\in.pcl C:\out.pdf
   pcltool.exe -barcodetext "*00432530070000006081*" -barcodefont "Free 3 of 9" C:\in.pcl C:\out.pdf
   pcltool.exe -barcodetext "*####################*" -barcodefont "Free 3 of 9" C:\in.pcl C:\out.pdf
   pcltool.exe -barcodetext "*#??????????????????#*" -barcodefont "Free 3 of 9" C:\in.pcl C:\out.pdf
   pcltool.exe -barcodetext "??????????????????????" -barcodefont "Free 3 of 9" C:\in.pcl C:\out.pdf

You can pass above options to VeryPDFPCLConverter() function according to your requirements, the following is the C# example to call the VeryPDFPCLConverter() function,

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Runtime.InteropServices;

 

namespace WindowsFormsApplication1

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        [DllImport(@"pcltoolsdk.dll", CharSet = CharSet.Auto)]

        static extern uint VeryPDFPCLConverter([MarshalAs(UnmanagedType.LPStr)] string strCmdLine);

 

        private void button1_Click(object sender, EventArgs e)

        {

            string strCmd;

            strCmd = "-$ XXXXXXXXXXXXX C:\\test.pcl C:\\out.pdf";

            uint nRet = VeryPDFPCLConverter(strCmd);

        }

    }

}

 

You can also call “pcltool.exe” from your C# source code directly, please refer to following C# example,

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Diagnostics;

 

namespace ConsoleApplication1

{

    class Program

    {

        static void Main(string[] args)

        {

            Process proc = new Process();

            proc.StartInfo.FileName = @"C:\\Program Files\\VeryPDF PCL Converter v2.0\\pcltool.exe";

            string strArguments = "";

            strArguments += "-pclcmd \"\\\"-J@PJL SET PAPER=Legal\\\" \\\"-J@PJL SET DEFAULT ORIENTATION = LANDSCAPE\\\"\"";

            strArguments += " C:\\test.pcl C:\\out2.pdf";

            Console.WriteLine(strArguments);

            proc.StartInfo.Arguments = @strArguments;

            proc.Start();

            proc.WaitForExit();

        }

    }

}

 

The following is a VB6 example to call VeryPDFPCLConverter() function,

 

Private Declare Function VeryPDFPCLConverter Lib "pcltoolsdk.dll" (ByVal strCommandLine As String) As Long

 

Private Sub PCL2PDF_Click()

    Dim nRet As Long

    Dim strCmd As String

    Dim strInPCL As String

    Dim strOutPDF As String

   

    strInPCL = App.Path & "\test.pcl"

    strOutPDF = App.Path & "\test.pcl.pdf"

   

    ChDir App.Path

   

    strCmd = "-$ XXXXXXXXXXXXX "

    strCmd = strCmd & " """ & strInPCL & """"

    strCmd = strCmd & " """ & strOutPDF & """"

    nRet = VeryPDFPCLConverter(strCmd)

    'MsgBox (Str(nRet))

End Sub

VN:F [1.9.20_1166]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.20_1166]
Rating: 0 (from 0 votes)

Related Posts

This entry was posted in PCL Converter and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


Verify Code   If you cannot see the CheckCode image,please refresh the page again!