This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Inst.AddPluginFromFile("D:\\PDFAPlugin.pvp"); | |
private void saveAsPDFAToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
PDFXEdit.IPXV_ExportConverter cnv = null; | |
for (uint i = 0; i < pdfCtl.Inst.ExportConvertersCount; i++) | |
{ | |
if (pdfCtl.Inst.ExportConverter[i].ID == "conv.exp.pdfa") | |
cnv = pdfCtl.Inst.ExportConverter[i]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PdfEditorCommandHandler : PDFXEdit.IUIX_CmdHandler | |
{ | |
public PDFXEdit.IPXV_Inst m_Inst = null; | |
public PDFXEdit.IUIX_CmdHandler m_OldSaveHandler = null; | |
public PDFXEdit.IUIX_CmdHandler m_OldSaveAsHandler = null; | |
private long m_nSaveID = 0; | |
private long m_nSaveAsID = 0; | |
public PdfEditorCommandHandler(PDFXEdit.IPXV_Inst Inst) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <typename T> | |
void ConvertAnnot(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; | |
pData->get_SColor(&pSClr); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DrawPagesCallback : PDFXEdit.IPXV_PagesViewDrawCallback | |
{ | |
public PDFXEdit.IAUX_Inst m_aInst; | |
public PDFXEdit.IUIX_Inst m_uiInst; | |
private PDFXEdit.IColor m_clrFill; | |
private PDFXEdit.IColor m_clrBorder; | |
private PDFXEdit.PXC_Rect m_rcDraw; | |
PDFXEdit.IUIX_Brush m_Brush; | |
PDFXEdit.IUIX_Pen m_Pen; | |
public DrawPagesCallback(PDFXEdit.IAUX_Inst aInst, PDFXEdit.IUIX_Inst uiInst) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class CustomEventTarget: | |
PDFXEdit.IUIX_ObjImpl, | |
IDisposable | |
{ | |
//Here we push custom implementation of the PagesView | |
public CustomEventTarget(PDFXEdit.IUIX_Obj obj, MainFrm parentForm) | |
{ | |
Obj_ = obj; | |
if (Obj_ != null) | |
Obj_.PushImpl(this); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uint m_nImagesCount = 0; | |
private void CountImageTypeContentItems(PDFXEdit.IPXC_Document srcDoc, PDFXEdit.IPXC_Content content) | |
{ | |
//Getting image or inline image types of the content items | |
for (uint j = 0; j < content.Items.Count; j++) | |
{ | |
PDFXEdit.IPXC_ContentItem ci = content.Items[j]; | |
if ((ci.Type == PDFXEdit.PXC_CIType.CIT_Image) || (ci.Type == PDFXEdit.PXC_CIType.CIT_InlineImage)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PDFXEdit.ICab openParams = m_Inst.CreateOpenDocParams(); | |
PDFXEdit.ICabNode openParamsRoot = openParams.Root; | |
openParamsRoot.SetBool("NoProgress", true); | |
m_Inst.ActiveMainFrm.OpenDocFromPath(ofd.FileName, openParams); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void addImageOnPageToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
PDFXEdit.IPXC_Document doc = pxcInst.NewDocument(); | |
PDFXEdit.IPXC_Image img = doc.AddImageFromFile("D:\\YourImage.png"); | |
PDFXEdit.PXC_Rect rcMedia; | |
rcMedia.left = 0; | |
rcMedia.bottom = 0; | |
//We will create 200*200 page | |
rcMedia.top = 200;//img.Height; | |
rcMedia.right = 200;//img.Width; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private PDFXEdit.PXC_Matrix Multiply(PDFXEdit.PXC_Matrix m1, PDFXEdit.PXC_Matrix m2) | |
{ | |
double t0 = (double)(m1.a * m2.a + m1.b * m2.c); | |
double t2 = (double)(m1.c * m2.a + m1.d * m2.c); | |
double t4 = (double)(m1.e * m2.a + m1.f * m2.c + m2.e); | |
m1.b = (double)(m1.a * m2.b + m1.b * m2.d); | |
m1.d = (double)(m1.c * m2.b + m1.d * m2.d); | |
m1.f = (double)(m1.e * m2.b + m1.f * m2.d + m2.f); | |
m1.a = t0; | |
m1.c = t2; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void changeAnnotationScaleToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
PDFXEdit.IPXC_Annotation annot = pdfCtl.Doc.CoreDoc.Pages[0].GetAnnot(0); | |
PDFXEdit.IPXC_AnnotData_Poly PData = (PDFXEdit.IPXC_AnnotData_Poly)annot.Data; | |
PDFXEdit.IPXC_MeasureRL measure = (PDFXEdit.IPXC_MeasureRL)PData.Measure; | |
//We'll set the scale from 33mm to 11m | |
measure.Ratio = "33 mm = 11 m"; | |
PDFXEdit.IPXC_NumberFormatArray nfa = measure.GetX(); | |
PDFXEdit.IPXC_NumberFormatItem nfi = nfa.CreateNewItem(); | |
nfi.FractionType = PDFXEdit.PXC_MeasureFractionType.MFT_AsDecimal; |