Interface function previous  top  next 
 

 Function list:
      1. long __stdcall CreatePDF(char *filenam)
      2. void __stdcall ClosePDF(long id)
      3. long __stdcall SetPDFSecurity(long id,long level ,long limit,char *userpassword,char *ownerpassword)
      4. long __stdcall SetPDFInfo(long id,char *title,char *subject,char *author,char *keyword,char *creator)
      5. long __stdcall AddPS(long id,char *filename)
      6. long __stdcall Convert(long id)
   Example

  1.  long __stdcall CreatePDF(char *filename)
   Description:
          Create a PDF file. If creates success, it will create a PS converter and return it's handle.
   Parameters:
          filename : It is created file name.
   Return Value:
          It returns a handle of PS Converter. A return value of zero indicates an error, otherwise is succeed.
 

  2.  void __stdcall ClosePDF(long id)
   Description:
          Close the created PDF file and destroy the converter.
   Parameters:
          id : A handle of PS Converter.
   Return Value:
          None

  3.  long __stdcall SetPDFSecurity(long id,long level ,long limit,char *userpassword,char *ownerpassword)
   Description:
          Set encrypts information. this code can be used after call CreatePDF function.
   Parameters:
          id : A handle of PS Converter.
          level : Encryption Level, it will equal 40 or 128, indicates 40-bit RC4 or 128-bit RC4.
          limit : A 16-btis control word for document permissions. The higher 8bits is reserved, the lower 8bits is valid.
  Description for lower 8bits
bit7 bit6 bit5 bit4 bit3 bit2 bit1 bit0
  bit0: Printing control bit, setting 1 is valid, otherwise invalid.
  bit1: Content copying control bit, setting value of 1 is valid, otherwise invalid.
  bit2: Document changing control bit, setting value of 1 is valid, otherwise invalid.
  Other bits are reserved.
          userpassword : pdf file open password
          ownerpassword : pdf file modify password
   Return Value
          Nonzero if it is successful; otherwise, it is zero.

  4.  long __stdcall SetPDFInfo(long id,char *title,char *subject,char *author,char *keyword,char *creator)
   Description:
          Set PDF file information.
   Parameters:
          id : A handle of PS Converter..
          title : Set title to PDF file , it may equal NULL.
          subject : Set subject to PDF file, it may equal NULL.
          author : Set author to PDF file, it may equal NULL.
          keywords : Set Keywords to PDF file, it may equal NULL.
          creator : Set Creator to PDF file, it may equal NULL.
   Return Value:
          Nonzero if it is successful; otherwise, it is zero.

  5.  long __stdcall AddPS(long id,char *filename)
   Description:
          Insert PS/EPS file into PDF file
   Parameters:
          id : A handle of PS Converter..
          filename : File name of ps/eps.
   Return Value:
          return value of 0 indicates an error, otherwise is succeed.
   
  6.  long __stdcall Convert(long id)
   Description:
          Start convert PS/EPS to PDF file
   Parameters:
          id : A handle of PS Converter..
   Return Value:
          Succed if the return value exceeds 0, or it is failed.


 Example:
  Here are several simple examples to make C. For more examples, you can refer to the directory "example".
  1. Converting multiple PS/EPS files to one PDF file.
      long id = CreatePDF(d:\\test\\out.pdf);
 

    if( id > 0 ) {

 

        AddPS(id, d:\\test\\input1.ps);

          AddPS(id, d:\\test\\inputn.ps);
          Convert(id);
          ClosePDF(id);
      }
   
  2. Converting PS/EPS files to encrypted PDF files.
      long id = CreatePDF(d:\\test\\out.pdf);
      if( id > 0 ) {
          SetPDFSecurity( id , 128 , 0 ,"user" , "owner" );
          AddPS(id, d:\\test\\input1.ps);
          AddPS(id, d:\\test\\inputn.ps);
          Convert(id);
          ClosePDF(id);
      }
   


http://www.adultpdf.com  
Copyright 2000-2008 by Adultpdf.com Inc. All rights reserved.