PXCp_StreamEncode

This Forum is for the use of Software Developers requiring help and assistance for Tracker Software's PDF-Tools SDK of Library DLL functions(only) - Please use the PDF-XChange Drivers API SDK Forum for assistance with all PDF Print Driver related topics or PDF-XChange Viewer SDK if appropriate.

Moderators: TrackerSupp-Daniel, Tracker Support, Vasyl-Tracker Dev Team, Chris - Tracker Supp, Sean - Tracker, Tracker Supp-Stefan

Post Reply
truane
User
Posts: 7
Joined: Tue Dec 07, 2010 3:46 pm

PXCp_StreamEncode

Post by truane »

Hi

Can anybody help or even an example of PXCp_StreamEncode using C#

I'm trying to call

Code: Select all

PXCp_StreamEncode(streamref, FilterType.ft_Flate, cparam); 
streamref is a new stream I have created and written to already.

But when I do the above call I get an error code of invalid parameters

The method and data structure are defined below -

Code: Select all

var cparam = new XcPro40Defs.PXCp_CompressParam();
cparam.CompressionLevel = 9;

[DllImport("xcpro40")]
        public static extern int PXCp_StreamEncode(int refStream, FilterType filterType, PXCp_CompressParam cparam);

public enum FilterType
        {
            ft_Unknown,
            ft_ASCIIHex,
            ft_ASCII85,
            ft_LZW,
            ft_Flate,
            ft_RLE,
            ft_CCITTFax,
            ft_JBIG2,
            ft_DCT,
            ft_JPX,
            ft_Crypt
        };

// Data for compress filter
		[StructLayout(LayoutKind.Sequential, Pack = 1)]
		public struct PXCp_CompressParam
		{
			// jpeg & j2k parameters:
			public int	Width;
			public int	Height;
			public byte	NumOfComponent;
			public byte	Quality;
			// Flate (zip) parameters:
			public int	CompressionLevel;
			// CCITT parametrs (also 'Widht' and 'Height' are necessary):
			public int	K;
			public int	bEndOfLine;
			public int	bEncodedeLineAlign;
			public int	bEndOfBlocks;
		};
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: PXCp_StreamEncode

Post by Corwin - Tracker Sup »

Hi truane,

Please make sure, that you are using managed IStream (which you can get for example from CreateStreamOnHGlobal function), but not the DotNet version.
truane
User
Posts: 7
Joined: Tue Dec 07, 2010 3:46 pm

Re: PXCp_StreamEncode

Post by truane »

Hi

Thanks for your response but I create the stream using the API as follows. Its not a windows stream its a PDF stream

Code: Select all

            int objRef;
            PXCp_ObjectCreateNew(pdfRef, out objRef);

            int refStream;
            PXCp_StreamCreate(out refStream, objRef);
Corwin - Tracker Sup
User
Posts: 664
Joined: Tue Nov 14, 2006 12:23 pm

Re: PXCp_StreamEncode

Post by Corwin - Tracker Sup »

Please send us your sample project (Zipped) , so we can check it here, pls ensure all license information is removed

Thanks
Post Reply