Getting strated PS to IMAGE SDK/COM previous  top  next 
 
We have provided very much example for customer (please see the developer package), it included the follow examples:
 
examples
    C#.NET 2005
    VB.NET 2005
    CBuilder
    Delphi
    VB
    VC
    C++
    ASP
    ASP.NET
 
Using PS to Image SDK in C#.NET 2005

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using System.Runtime.InteropServices; //requirement class

namespace demo_cs_2005
{
    public partial class Form1 : Form
    {
        //SDK interface definitions
        //==============================================================================================================
        [DllImport("pstoimage", EntryPoint = "_oakBegin@0", CallingConvention = CallingConvention.StdCall)]
        public static extern int oakBegin();

        [DllImport("pstoimage", EntryPoint = "_oakEnd@4", CallingConvention = CallingConvention.StdCall)]
        public static extern void oakEnd(int id);

        [DllImport("pstoimage", EntryPoint = "_oakExport@4", CallingConvention = CallingConvention.StdCall)]
        public static extern int oakExport(int id);

        [DllImport("pstoimage", EntryPoint = "_oakSetOption@24", CallingConvention = CallingConvention.StdCall)]
        public static extern int oakSetOption(int id, int code, int nOptVal1,int nOptVal2,string sOptVal1,string sOptVal2);

        [DllImport("pstoimage", EntryPoint = "_oakGetOption@24", CallingConvention = CallingConvention.StdCall)]
        public static extern int oakGetOption(int id, int code, int nOptVal1,int nOptVal2,string sOptVal1,string sOptVal2);
        //==============================================================================================================

        //Supported option definitions
        //==============================================================================================================
        const int OAK_Set_Input = 5301;
        const int OAK_Set_Output = 5302;
        const int OAK_Set_Callback = 5306;
        const int OAK_Set_Color = 5309;
        const int OAK_Set_DPI = 5310;
        const int OAK_Set_Compress = 5311;
        const int OAK_Set_Quality = 5312;
        //==============================================================================================================

        //Supported image formats
        //==============================================================================================================
        const int OAK_FILE_TIF = 105; /*tiff format*/
        const int OAK_FILE_JPG = 106; /*jpeg format*/
        const int OAK_FILE_BMP = 107; /*bmp format*/
        const int OAK_FILE_GIF = 108; /*gif format*/
        const int OAK_FILE_PCX = 109; /*pcx format*/
        const int OAK_FILE_PNG = 110; /*png format*/
        const int OAK_FILE_EMF = 111; /*emf format*/
        const int OAK_FILE_WMF = 112; /*wmf format*/
        //==============================================================================================================

        //TIFF compression definitions
        //==============================================================================================================
        const int OAK_COMPRESSION_NONE = 1; /* dump mode */
        const int OAK_COMPRESSION_RLE = 2; /* CCITT modified Huffman RLE */
        const int OAK_COMPRESSION_G3 = 3; /* CCITT Group 3 fax encoding */
        const int OAK_COMPRESSION_G4 = 4; /* CCITT Group 4 fax encoding */
        const int OAK_COMPRESSION_LZW = 5; /* Lempel-Ziv & Welch */
        const int OAK_COMPRESSION_JPEG = 6; /* %JPEG DCT compression */
        const int OAK_COMPRESSION_PACKBITS = 7; /* Macintosh RLE */
        //==============================================================================================================

        //Supported color depth
        //==============================================================================================================
        const int oak_color_1 =1; //2 color
        const int oak_color_4 =4; //16 color
        const int oak_color_8_g =7; //256 grayscale color
        const int oak_color_8 =8; //256 color
        const int oak_color_24 = 24; //true color
        //==============================================================================================================

        public Form1()
        {
              InitializeComponent();
        }

        //------------------------------------------------------------------------------------------------
        // Convert one ps/eps file to true color bmp file.
        //------------------------------------------------------------------------------------------------
        private void btnDemo1_Click(object sender, EventArgs e)
        {
              int id, iRet;

              id = oakBegin();
              oakSetOption(id, OAK_Set_Input, 0, 0, "_test_01.ps", ""); //input file.
              oakSetOption(id, OAK_Set_Output, OAK_FILE_BMP, 0, "mytest.bmp", ""); //output format and file.
              oakSetOption(id, OAK_Set_DPI, 120, 120, "", ""); //horizontal and vertical dpi.
              iRet = oakExport(id);
              oakEnd(id);
        }

        //------------------------------------------------------------------------------------------------
        // Convert one ps/eps file to grayscale jpeg file.
        //------------------------------------------------------------------------------------------------
        private void btnDemo2_Click(object sender, EventArgs e)
        {
              int id, iRet;

              id = oakBegin();
              oakSetOption(id, OAK_Set_Input, 0, 0, "_test_02.eps", ""); //input file.
              oakSetOption(id, OAK_Set_Output, OAK_FILE_JPG, 0, "mytest.jpeg", ""); //output format and file.
              oakSetOption(id, OAK_Set_DPI, 120, 120, "", ""); //horizontal and vertical dpi.
              oakSetOption(id, OAK_Set_Color, oak_color_8_g, 0, "", ""); //grayscale jpeg
              oakSetOption(id, OAK_Set_Quality, 75, 0, "", ""); //jpeg quality.
              iRet = oakExport(id);
              oakEnd(id);
        }

        //------------------------------------------------------------------------------------------------
        // Convert sevrial ps/eps files to a multi-page tiff file.
        //------------------------------------------------------------------------------------------------
        private void btnDemo3_Click(object sender, EventArgs e)
        {
              int id, iRet;
              int isMultiPage = 1;

              id = oakBegin();
              oakSetOption(id, OAK_Set_Input, 0, 0, "_test_01.ps", ""); //input file.
              oakSetOption(id, OAK_Set_Input, 0, 0, "_test_02.eps", ""); //input file.
              oakSetOption(id, OAK_Set_Output, OAK_FILE_TIF, isMultiPage, "mytest.tiff", ""); //multi-page tiff
              oakSetOption(id, OAK_Set_DPI, 96, 96, "", ""); //horizontal and vertical dpi.
              oakSetOption(id, OAK_Set_Compress, OAK_COMPRESSION_LZW, 0, "", ""); //tiff compression
              iRet = oakExport(id);
              oakEnd(id);
        }
    }
}

 
 For more information, please refer to reference.
 


http://www.oakdoc.com  
Copyright 2008 by OakDoc Technology, Inc. All rights reserved.