Convert Postscript file to transparent png image

Another issue that I ran into was trying to use the "Postscript to Image Converter".  For some eps files I would like to convert them to transparent png files.  I downloaded the source and tried to use the C# example and it throws an exception running the sample on Windows 7 64-bit.  Is the demo version only work on 32 bit system?
=========================
Postscript to Image Converter SDK is support both 32bit and 64bit systems.

Please refer to the C# example for PS to Image conversion at below,

~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace ConsoleApplication1
{
    class Program
    {
        const int TRUE = 1;
        const int FALSE = 0;
        const int COMPRESSION_NONE = 1;            // dump mode
        const int COMPRESSION_CCITTRLE = 2;        // CCITT modified Huffman RLE
        const int COMPRESSION_CCITTFAX3 = 3;    // CCITT Group 3 fax encoding
        const int COMPRESSION_CCITTFAX4 = 4;    // CCITT Group 4 fax encoding
        const int COMPRESSION_LZW = 5;            // Lempel-Ziv  & Welch
        const int COMPRESSION_JPEG = 7;            // %JPEG DCT compression
        const int COMPRESSION_PACKBITS = 32773;    // Macintosh RLE
       
        [DllImport(@"ps2imgsdk.dll", CharSet = CharSet.Auto)]
        static extern uint VeryPDF_PSToImageConverter(
            [MarshalAs(UnmanagedType.LPStr)] string FileName,
            [MarshalAs(UnmanagedType.LPStr)] string OutputName,
            int nIsWidthAndHeight, int xResORWidth, int yResORHeight, int nCompression, int bIsMultiPage,
            int nFirstPage, int nLastPage, int nQuality, int nBitCount, int bGrayscale,
            IntPtr lpUserPassword, IntPtr lpOwnPassword, int bTransparentBackground);

        [DllImport(@"ps2imgsdk.dll", CharSet = CharSet.Ansi)]
        static extern uint VeryPDF_PSToImageSetCode(string lpRegcode);

        static void Main(string[] args)
        {
            string lpPSFile = "C:\\verydoc.ps";
            string lpImgFile = "C:\\verydoc.png";
            IntPtr UserPassword = IntPtr.Zero;
            IntPtr OwnPassword = IntPtr.Zero;
            int bTransparentBackground = 1;
            VeryPDF_PSToImageSetCode("XXXXXXXXXXXXXXXXXXXXXXX");
            uint nResult = VeryPDF_PSToImageConverter(lpPSFile, lpImgFile, FALSE, 200, 200, COMPRESSION_PACKBITS,
                FALSE, -1, -1, 100, 24, FALSE, UserPassword, OwnPassword, bTransparentBackground);
        }
    }
}
~~~~~~~~~~~~~~~~~~~~~~~~~~

If you wish create PNG image with Transparent Background, please set bTransparentBackground option to TRUE.

The free trial version of Postscript to Image Converter SDK/COM can be downloaded from following web URL,

https://www.verydoc.com/ps2imgsdk.zip

image

VeryDOC

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

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!