-
-
Save Polaringu/e0ecba2e44de2601b8127ee3b04d33d0 to your computer and use it in GitHub Desktop.
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 iIXCExperimentsToolStripMenuItem_Click(object sender, EventArgs e) | |
{ | |
PDFXEdit.IPXC_Document doc = pxcInst.NewDocument(); | |
PDFXEdit.IIXC_Inst iInst = (PDFXEdit.IIXC_Inst)pdfCtl.Inst.GetExtension("IXC"); | |
PDFXEdit.IIXC_Image iImage = iInst.CreateEmptyImage(); | |
iImage.Load(System.IO.Directory.GetParent(System.Environment.CurrentDirectory).Parent.FullName + "\\Resources\\multipage_tif_example.tif"); | |
for (uint i = 0; i < iImage.PagesCount; i++) | |
{ | |
PDFXEdit.IIXC_Page iPage = iImage.GetPage(i); | |
iPage.ConvertToFormat(PDFXEdit.IXC_PageFormat.PageFormat_8Gray); | |
PDFXEdit.PXC_Rect rcMedia; | |
rcMedia.left = iPage.Rect.left; | |
rcMedia.bottom = iPage.Rect.bottom; | |
rcMedia.top = iPage.Rect.top; | |
rcMedia.right = iPage.Rect.right; | |
PDFXEdit.IPXC_UndoRedoData urData; | |
PDFXEdit.IPXC_Page page = doc.Pages.InsertPage(0, ref rcMedia, out urData); | |
PDFXEdit.IPXC_Image img = doc.AddImageFromIXCPage(iPage); | |
PDFXEdit.IPXC_ContentCreator CC = doc.CreateContentCreator(); | |
//We'll need to do matrix Rect2Rect from the rectangle with 1pt width and height (as it's interpreted in the PDF specification) into the page rect | |
PDFXEdit.PXC_Rect rcTo; | |
rcTo.left = 0; | |
rcTo.right = 1; | |
rcTo.top = 1; | |
rcTo.bottom = 0; | |
PDFXEdit.PXC_Matrix m = auxInst.MathHelper.Matrix_RectToRect(ref rcTo, ref rcMedia); | |
CC.ConcatCS(m); | |
CC.PlaceImage(img); | |
page.PlaceContent(CC.Detach(), (uint)PDFXEdit.PXC_PlaceContentFlags.PlaceContent_Replace); | |
} | |
pdfCtl.OpenDocFrom(doc); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment