IPXS_EncodeFiltersArray::AddFilterInfo Method

From Tracker Software PDF SDK
Jump to: navigation, search
(Label ToWrite removed)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
 
{{#customTitle:IPXS_EncodeFiltersArray::AddFilterInfo Method}}
 
{{#customTitle:IPXS_EncodeFiltersArray::AddFilterInfo Method}}
 
{{#parentPage:PXV:IPXS_EncodeFiltersArray#Methods|AddFilterInfo|method}}
 
{{#parentPage:PXV:IPXS_EncodeFiltersArray#Methods|AddFilterInfo|method}}
{{ToWrite}}
+
 
 
{{ToReview}}
 
{{ToReview}}
  
The method of interface of PDF-XChange Editor SDK.
+
Adds filters into encode filters array
  
 
== Syntax ==
 
== Syntax ==
Line 14: Line 14:
 
== Parameters ==
 
== Parameters ==
 
;nFilter
 
;nFilter
:[in]  Value of ULONG.
+
:[in]  Value of ULONG containing the filter's atom ID.
 
;pParams
 
;pParams
:[in]  Pointer to [[PXV:IPXS_PDFVariant|IPXS_PDFVariant]].
+
:[in]  Pointer to [[PXV:IPXS_PDFVariant|IPXS_PDFVariant]] containing the filer's parameters.
  
 
== Return Value ==
 
== Return Value ==

Latest revision as of 01:05, 17 September 2018


Adds filters into encode filters array

Syntax

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

Parameters

nFilter
[in] Value of ULONG containing the filter's atom ID.
pParams
[in] Pointer to IPXS_PDFVariant containing the filer's parameters.

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