Getting strated PS to PDF 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 PDF 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("pstopdf", EntryPoint = "_oakBegin@0", CallingConvention = CallingConvention.StdCall)]
        public static extern int oakBegin();

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

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

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

        [DllImport("pstopdf", 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_PDFInfo = 5307;
        const int OAK_Set_PDFEncrypt = 5308;
        //==============================================================================================================

        //Supported pdf information
        //==============================================================================================================
        const string OAK_PDF_TITLE = "title";
        const string OAK_PDF_SUBJECT = "subject";
        const string OAK_PDF_AUTHOR = "author";
        const string OAK_PDF_KEYWORDS = "keywords";
        const string OAK_PDF_APPLICATION = "creator";
        //==============================================================================================================

        //Supported the length of pdf encrypt
        //==============================================================================================================
        const int OAK_PDF_ENCRYPT_LEVEL_40 = 40;
        const int OAK_PDF_ENCRYPT_LEVEL_128 = 128;
        //==============================================================================================================

        //Supported operation limited
        //==============================================================================================================
        const int OAK_PDF_PERMISSION_NONE = 0;
        const int OAK_PDF_PERMISSION_PRINT = 1;
        const int OAK_PDF_PERMISSION_COPYING = 2;
        const int OAK_PDF_PERMISSION_MODIFY = 4;
        const int OAK_PDF_PERMISSION_ALL = 7;
        //==============================================================================================================

        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_Input, 0, 0, "_test_02.eps", ""); //input file.
              oakSetOption(id, OAK_Set_Output, 0, 0, "mytest_general.pdf", ""); //output pdf file.

              oakSetOption(id, OAK_Set_PDFInfo, 0, 0, OAK_PDF_TITLE, "untitled document");
              oakSetOption(id, OAK_Set_PDFInfo, 0, 0, OAK_PDF_AUTHOR, "bobol");
              oakSetOption(id, OAK_Set_PDFInfo, 0, 0, OAK_PDF_APPLICATION, "OakDoc PS to PDF sdk demo");

              iRet = oakExport(id);
              oakEnd(id);
        }

        //------------------------------------------------------------------------------------------------
        // Convert one ps/eps file to an restricted pdf file.
        //------------------------------------------------------------------------------------------------
        private void btnDemo2_Click(object sender, EventArgs e)
        {
              int id, iRet;
              string sOwnerPw = "1111";
              string sUserPw = "2222";

              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, 0, 0, "mytest_general.pdf", ""); //output pdf file.

              oakSetOption(id, OAK_Set_PDFInfo, 0, 0, OAK_PDF_TITLE, "untitled document");
              oakSetOption(id, OAK_Set_PDFInfo, 0, 0, OAK_PDF_AUTHOR, "bobol");
              oakSetOption(id, OAK_Set_PDFInfo, 0, 0, OAK_PDF_APPLICATION, "OakDoc PS to PDF sdk demo");

              oakSetOption(id, OAK_Set_PDFEncrypt, OAK_PDF_ENCRYPT_LEVEL_128, OAK_PDF_PERMISSION_PRINT + OAK_PDF_PERMISSION_COPYING, sUserPw, sOwnerPw);

              iRet = oakExport(id);
              oakEnd(id);


        }
    }
}

 
 For more information, please refer to reference.
 


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