Last active
September 25, 2015 19:47
-
-
Save bjoerntx/7d6ac8d255c87996bee3 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
/*************************************************************** | |
* InsertTIFF method | |
* description: Insert a new section for each page and inserts | |
* the images | |
* | |
* param: image - the image path | |
* startAtNewPage - specifies whether the first | |
* image is inserted on a new page or not | |
***************************************************************/ | |
private void InsertTIFF(string image, bool startAtNewPage) | |
{ | |
// make sure the page unit is twips | |
textControl1.PageUnit = TXTextControl.MeasuringUnit.Twips; | |
bool bFirstPage = false; | |
// retrieve the images | |
List<Image> images = SplitMultipageTIFF(image); | |
foreach (Image img in images) | |
{ | |
// create a new TXTextControl.Image from each image | |
TXTextControl.Image TXImg = new TXTextControl.Image(img); | |
if (bFirstPage == false && startAtNewPage == true) | |
{ | |
// insert a new section | |
textControl1.Sections.Add( | |
TXTextControl.SectionBreakKind.BeginAtNewPage); | |
bFirstPage = true; | |
} | |
// add the image and adjust the page size and margins according | |
// to the image | |
textControl1.Images.Add(TXImg, | |
textControl1.InputPosition.Page, | |
new Point(0, 0), | |
TXTextControl.ImageInsertionMode.FixedOnPage); | |
textControl1.Sections.GetItem().Format.PageMargins = | |
new TXTextControl.PageMargins(0, 0, 0, 0); | |
textControl1.Sections.GetItem().Format.PageSize = | |
new TXTextControl.PageSize( | |
TXImg.Size.Width, TXImg.Size.Height); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment