IPXS_EncodeFiltersArray::AddFilterInfo Method

From Tracker Software PDF SDK
Revision as of 00:40, 23 June 2016 by Oliynykd (Talk | contribs)

Jump to: navigation, search


The method of interface of PDF-XChange Editor SDK.

Syntax

HRESULT AddFilterInfo([in]  ULONG             nFilter,
                      [in]  IPXS_PDFVariant*  pParams);

Parameters

nFilter
[in] Value of ULONG.
pParams
[in] Pointer to IPXS_PDFVariant.

Return Value

Returns S_OK if operation was successful or error code in other cases.

Sample

//C#
private void AddJPEG(PDFXEdit.IPXS_EncodeFiltersArray arr, int nQuality = 75 /*1 - 100*/)
{
	PDFXEdit.IPXS_PDFVariant varDist = pxsInst.NewVar_Dict();
	varDist.Dict_SetInt("Quality", nQuality);
	arr.AddFilterInfo(pxsInst.StrToAtom("DCTDecode"), varDist);
}

private void AddJPEG2000(PDFXEdit.IPXS_EncodeFiltersArray arr, int nQuality = 75 /*1 - 100*/)
{
	PDFXEdit.IPXS_PDFVariant varDist = pxsInst.NewVar_Dict();
	varDist.Dict_SetInt("Quality", nQuality);
	varDist.Dict_SetBool("EncodeLosslessly", true);
	arr.AddFilterInfo(pxsInst.StrToAtom("JPXDecode"), varDist);
}

private void AddFlate(PDFXEdit.IPXS_EncodeFiltersArray arr, int nCompressionLevel = 0 /* -1 - 9 */)
{
	PDFXEdit.IPXS_PDFVariant varDist = pxsInst.NewVar_Dict();
	varDist.Dict_SetInt("Level", nCompressionLevel);
	arr.AddFilterInfo(pxsInst.StrToAtom("FlateDecode"), varDist);
}
private void AddJBIG2(PDFXEdit.IPXS_EncodeFiltersArray arr, int nQuality = 75 /*0 - 100*/)
{
	arr.AddFilterInfo(pxsInst.StrToAtom("JBIG2Decode"), null);

}

private void AddRunLength(PDFXEdit.IPXS_EncodeFiltersArray arr)
{
	arr.AddFilterInfo(pxsInst.StrToAtom("RunLengthDecode"), null);
}


private void AddLZW(PDFXEdit.IPXS_EncodeFiltersArray arr, int nEarlyChange = 0 /*0 - 1*/)
{
	PDFXEdit.IPXS_PDFVariant varDist = pxsInst.NewVar_Dict();
	varDist.Dict_SetInt("EarlyChange", nEarlyChange);
	arr.AddFilterInfo(pxsInst.StrToAtom("LZWDecode"), varDist);
			

}

private void AddCCITT3(PDFXEdit.IPXS_EncodeFiltersArray arr, int nK = 0)
{
	PDFXEdit.IPXS_PDFVariant var = pxsInst.NewVar_Dict();
	var.Dict_SetInt("K", nK);
	arr.AddFilterInfo(pxsInst.StrToAtom("CCITTFaxDecode"), var);
}

private void AddCCITT4(PDFXEdit.IPXS_EncodeFiltersArray arr)
{
	AddCCITT3(arr, -1);
}


PDFXEdit.IPXS_EncodeFiltersArray arr = pxsInst.Create_EncodeFiltersArray();
AddJPEG(arr, Compression_JPEG); 
AddFlate(arr);
pdfCtl.Doc.CoreDoc.SetEncodersForStreamType("Image.TrueColor", arr);

See Also

IPXS_EncodeFiltersArray