Skip to content

Instantly share code, notes, and snippets.

View Polaringu's full-sized avatar

Alex Polaringu

  • SoftServe
  • Ukraine
View GitHub Profile
SourceCtrl.OpenDocFromPath(appRootDir + "\\SP.pdf");
PDFXEdit.IPXV_Document sourceDoc = SourceCtrl.Doc;
DestinationCtrl.OpenDocFromPath(appRootDir + "\\SF.pdf");
EmbeddPageAsAnIcon(sourceDoc.CoreDoc, DestinationCtrl.Doc.CoreDoc, DestinationCtrl.Inst);
public void InitializeTwoControls()
{
//First frame will be with full Control functionality
PDFXEdit.IPXV_MainFrame firstMainFrame = pdfCtl.Inst.MainFrm[0];
PDFXEdit.IPXV_MainView firstMainView = firstMainFrame.View;
PDFXEdit.IPXC_Document doc = pxcInst.OpenDocumentFromFile("D:\\TestFile.pdf", null, null);
firstMainFrame.OpenDocFrom(doc);
firstMainView.CmdPaneTop.Show();
//Setting up preview frame
private void EmbeddPageAsAnIcon(PDFXEdit.IPXC_Document srcDoc, PDFXEdit.IPXC_Document destDoc, PDFXEdit.IPXV_Inst Inst)
{
if (destDoc.HasAcroForm != false)
{
PDFXEdit.IPXC_FormField ff = destDoc.AcroForm.GetFieldByName("Button1");
if (ff != null)
{
PDFXEdit.IPXC_Annotation annot = ff.Widget[0];
PDFXEdit.IPXC_AnnotData_Widget WData = (PDFXEdit.IPXC_AnnotData_Widget)annot.Data;
PDFXEdit.IPXC_Page srcPage = srcDoc.Pages[0];
template <typename T>
void ConvertAnnotDataToGrey(T* pData)
{
float r = 0, g = 0, b = 0;
CComPtr<PXC::IColor> pFClr;
CComPtr<PXC::IColor> pSClr;
pData->get_FColor(&pFClr);
if (pFClr == nullptr)
return;
PXC::ColorType nType = PXC::ColorType_None;
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))
@Polaringu
Polaringu / op.document.resizePages.cs
Last active December 16, 2015 07:52
Resize pages operation code sample
//C#
private void ResizePageToA2(PDFXEdit.IPXV_Document pDoc, PDFXEdit.PXV_Inst pInst)
{
if (pDoc == null)
return;
int nID = pInst.Str2ID("op.document.resizePages", false);
PDFXEdit.IOperation pOp = pInst.CreateOp(nID);
PDFXEdit.ICabNode input = pOp.Params.Root["Input"];
input.v = pDoc;
PDFXEdit.ICabNode options = pOp.Params.Root["Options"];