private ceTe.DynamicPDF.TextAlign ConvertTextAlign(PDFTextAlign textAlign) { switch (textAlign) { case PDFTextAlign.Center: return(ceTe.DynamicPDF.TextAlign.Center); case PDFTextAlign.FullJustify: return(ceTe.DynamicPDF.TextAlign.FullJustify); case PDFTextAlign.Justify: return(ceTe.DynamicPDF.TextAlign.Justify); case PDFTextAlign.Left: return(ceTe.DynamicPDF.TextAlign.Left); case PDFTextAlign.Right: return(ceTe.DynamicPDF.TextAlign.Right); default: return(ceTe.DynamicPDF.TextAlign.Left); } }
/// <summary> /// Adds a text label object to the specified page. /// </summary> /// <param name="text">The text that you want to be displayed in the label.</param> /// <param name="xCoordinate">X-Coordinate label should be located.</param> /// <param name="yCoordinate">Y-Coordinate label should be located.</param> /// <param name="width">Width of the label.</param> /// <param name="height">Height of the label.</param> /// <param name="font">The font to be used for the label.</param> /// <param name="textSize">The text size.</param> /// <param name="txtAlign">Alignment within the label (left, right, center).</param> /// <param name="pageNumber">Page number you would like image placed.</param> /// <returns>True if addition was successful, False if page number of out of bounds.</returns> public Boolean PDFAddLabel(string text, float xCoordinate, float yCoordinate, float width, float height, PDFFonts font, float textSize, PDFTextAlign txtAlign, int pageNumber) { return(this.PDFAddLabel(text, xCoordinate, yCoordinate, width, height, font, textSize, txtAlign, this._PDFDefaultColor, pageNumber)); }
/// <summary> /// Adds a text label object to the specified page. /// </summary> /// <param name="text">The text that you want to be displayed in the label.</param> /// <param name="xCoordinate">X-Coordinate label should be located.</param> /// <param name="yCoordinate">Y-Coordinate label should be located.</param> /// <param name="width">Width of the label.</param> /// <param name="height">Height of the label.</param> /// <param name="font">The font to be used for the label.</param> /// <param name="textSize">The text size.</param> /// <param name="txtAlign">Alignment within the label (left, right, center).</param> /// <param name="txtColor">Color of the text.</param> /// <param name="pageNumber">Page number you would like image placed.</param> /// <returns>True if addition was successful, False if page number of out of bounds.</returns> public Boolean PDFAddLabel(string text, float xCoordinate, float yCoordinate, float width, float height, PDFFonts font, float textSize, PDFTextAlign txtAlign, PDFColor txtColor, int pageNumber) { if (pageNumber > this._PDFDocumentPages.Count) { return(false); } ArrayList tempArray = new ArrayList(); tempArray.Add(PDFObjectType.Label); tempArray.Add(text); tempArray.Add(xCoordinate); tempArray.Add(yCoordinate); tempArray.Add(width); tempArray.Add(height); tempArray.Add(this.ConvertPDFFonts(font)); // Insert the preferred type fron the ceTe library tempArray.Add(textSize); tempArray.Add(this.ConvertTextAlign(txtAlign)); // Insert the preferred type from the ceTe library tempArray.Add(this.ConvertPDFColor(txtColor)); // Insert the preferred type from the ceTe library pageNumber--; // Decrement the number, because the arrray starts at 0 not 1 // Add teh object to the array ArrayList tempArray2 = (ArrayList)this._PDFDocumentPages[pageNumber]; tempArray2.Add(tempArray); return(true); }