Skip to content

Instantly share code, notes, and snippets.

View Polaringu's full-sized avatar

Alex Polaringu

  • SoftServe
  • Ukraine
View GitHub Profile
private void AutoGenerateBookmarksFromText(PDFXEdit.IPXC_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
int nID = Inst.Str2ID("op.bookmarks.autoGenerateFromText", false);
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
var input = Op.Params.Root["Input"];
input.v = Doc;
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
options["PagesRange.Type"].v = 1; //All
//enum eAGBFlags
//{
private void addRotatedTextToolStripMenuItem_Click(object sender, EventArgs e)
{
PDFXEdit.IPXC_Document doc = pxcInst.NewDocument();
PDFXEdit.PXC_Rect rcMedia;
rcMedia.left = 0;
rcMedia.bottom = 0;
rcMedia.top = 800;
rcMedia.right = 600;
PDFXEdit.IPXC_UndoRedoData urData;
public bool HasInvalidPaths(PDFXEdit.IPXC_Annotation annot)
{
uint invalidCount = 0;
uint GoTo = pxsInst.StrToAtom("GoTo");
uint GoToR = pxsInst.StrToAtom("GoToR");
uint Launch = pxsInst.StrToAtom("Launch");
PDFXEdit.IPXC_ActionsList actions = annot.get_Actions(PDFXEdit.PXC_TriggerType.Trigger_Up);
for (uint k = 0; k < actions.Count; k++)
{
if ((actions[k].Type == GoTo) || (actions[k].Type == GoToR))
private void DrawingSamples()
{
IPXC_Document doc = m_Inst.NewDocument();
PXC_Rect rc = new PXC_Rect();
rc.right = 600;
rc.top = 800;
IPXC_UndoRedoData urd;
doc.Pages.AddEmptyPages(0, 1, rc, null, out urd);
IPXC_Page page = doc.Pages[0];
class CustomComboCommandHandler : IUIX_CmdHandler
{
public IPXV_Inst m_Inst = null;
public IUIX_Inst m_uiInst = null;
public CustomComboCommandHandler(IPXV_Inst Inst)
{
m_Inst = Inst;
m_uiInst = (IUIX_Inst)Inst.GetExtension("UIX");
}
private void AddBatesNumberingToDocByIndex(PDFXEdit.IPXC_Document Doc, PDFXEdit.IPXV_Inst Inst, long nStart, out long nFinish)
{
int nID = Inst.Str2ID("op.document.addBatesNumbering", false);
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
var input = Op.Params.Root["Input"];
input.v = Doc;
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
options["PagesRange.Type"].v = "All";
options["CenterHeaderText"].v = "<<Bates Number#3#1#A#B>>";
options["Font.Size"].v = 36;
private void AddBatesNumberingToDoc(PDFXEdit.IOperation Op, PDFXEdit.IPXC_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
var input = Op.Params.Root["Input"];
input.v = Doc;
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
options["PagesRange.Type"].v = "All";
options["CenterHeaderText"].v = "<<Bates Number#3#1#A#B>>";
options["Font.Size"].v = 36;
Op.Do();
}
//Drop target that will contain the custom drag and drop implementation for the given object
public MyDropTarget myDropTarget = null; //PS: Do not forget to dispose of it (we do it in Form1_FormClosed)
//Method where the myDropTarget is initialized
void InitializePagesViewAsDropTarget()
{
PDFXEdit.IUIX_Obj obj = pdfCtl.Doc.ActiveView.PagesView.Obj;
//Setting style of the object so it will accept dropping
obj.SetStyleEx((int)PDFXEdit.UIX_ObjStyleExFlags.UIX_ObjStyleEx_DropTarget, (int)PDFXEdit.UIX_ObjStyleExFlags.UIX_ObjStyleEx_DropTarget);
private void ReplaceImage(PDFXEdit.IPXV_Document Doc, PDFXEdit.IPXV_Inst Inst)
{
int nID = Inst.Str2ID("op.document.replaceImage", false);
PDFXEdit.IOperation Op = Inst.CreateOp(nID);
var input = Op.Params.Root["Input"];
input.Add().v = Doc.CoreDoc;
PDFXEdit.ICabNode options = Op.Params.Root["Options"];
int nSelID = Inst.Str2ID("selection.contentItems", false);
uint nPage = 0; //Page number that will have it's image content item edited
//First we need to create content items selection
private void AddSignatureWithTemplate(IPXV_Inst Inst, IPXV_Document Doc)
{
int nID = Inst.Str2ID("op.document.addDigitalSignature", false);
IOperation Op = Inst.CreateOp(nID);
ICabNode input = Op.Params.Root["Input"];
input.Add().v = Doc;
ICabNode options = Op.Params.Root["Options"];
options["PageNumber"].v = 0;
options["UseFileCertificate"].v = true;
options["DigiSigType"].v = 1;