Porting update.

git-svn-id: svn://svn.code.sf.net/p/itextsharp/code/trunk@20 820d3149-562b-4f88-9aa4-a8e61a3485cf
master
psoares33 2009-06-02 23:10:28 +00:00
parent 9e5c88451d
commit b972119de6
17 changed files with 1560 additions and 1027 deletions

View File

@ -1,101 +1,121 @@
using System;
/*
* Copyright 2005 by Michael Niedermair.
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text {
/**
* Chapter with auto numbering.
*
* @author Michael Niedermair
*/
public class ChapterAutoNumber : Chapter {
using System;
/*
* Copyright 2005 by Michael Niedermair.
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text {
/**
* Chapter with auto numbering.
*
* @author Michael Niedermair
*/
public class ChapterAutoNumber : Chapter {
/**
* Create a new object.
*
* @param para the Chapter title (as a <CODE>Paragraph</CODE>)
* Is the chapter number already set?
* @since 2.1.4
*/
public ChapterAutoNumber(Paragraph para) : base(para, 0) {
}
protected bool numberSet = false;
/**
* Create a new objet.
*
* @param title the Chapter title (as a <CODE>String</CODE>)
*/
public ChapterAutoNumber(String title) : base(title, 0) {
}
/**
* Create a new section for this chapter and ad it.
*
* @param title the Section title (as a <CODE>String</CODE>)
* @return Returns the new section.
*/
public override Section AddSection(String title) {
/**
* Create a new object.
*
* @param para the Chapter title (as a <CODE>Paragraph</CODE>)
*/
public ChapterAutoNumber(Paragraph para) : base(para, 0) {
}
/**
* Create a new objet.
*
* @param title the Chapter title (as a <CODE>String</CODE>)
*/
public ChapterAutoNumber(String title) : base(title, 0) {
}
/**
* Create a new section for this chapter and ad it.
*
* @param title the Section title (as a <CODE>String</CODE>)
* @return Returns the new section.
*/
public override Section AddSection(String title) {
if (AddedCompletely) {
throw new InvalidOperationException("This LargeElement has already been added to the Document.");
}
return AddSection(title, 2);
}
/**
* Create a new section for this chapter and add it.
*
* @param title the Section title (as a <CODE>Paragraph</CODE>)
* @return Returns the new section.
*/
public override Section AddSection(Paragraph title) {
return AddSection(title, 2);
}
/**
* Create a new section for this chapter and add it.
*
* @param title the Section title (as a <CODE>Paragraph</CODE>)
* @return Returns the new section.
*/
public override Section AddSection(Paragraph title) {
if (AddedCompletely) {
throw new InvalidOperationException("This LargeElement has already been added to the Document.");
}
return AddSection(title, 2);
return AddSection(title, 2);
}
/**
* Changes the Chapter number.
* @param number the new chapter number
* @since 2.1.4
*/
public int SetAutomaticNumber(int number) {
if (!numberSet) {
number++;
base.SetChapterNumber(number);
numberSet = true;
}
return number;
}
}
}
}

View File

@ -412,5 +412,13 @@ namespace iTextSharp.text {
public virtual bool SetMarginMirroring(bool marginMirroring) {
return false;
}
/**
* @see com.lowagie.text.DocListener#setMarginMirroring(boolean)
* @since 2.1.6
*/
public virtual bool SetMarginMirroringTopBottom(bool MarginMirroring) {
return false;
}
}
}

View File

@ -100,9 +100,18 @@ namespace iTextSharp.text {
public class Document : IDocListener {
// membervariables
///<summary> This constant may only be changed by Paulo Soares and/or Bruno Lowagie. </summary>
private const string ITEXT_VERSION = "iTextSharp 4.1.2 (based on iText 2.1.2u)";
/**
* This constant may only be changed by Paulo Soares and/or Bruno Lowagie.
* @since 2.1.6
*/
private const String ITEXT = "iText";
/**
* This constant may only be changed by Paulo Soares and/or Bruno Lowagie.
* @since 2.1.6
*/
private const String RELEASE = "2.1.6_SNAPSHOT";
/** This constant may only be changed by Paulo Soares and/or Bruno Lowagie. */
private const String ITEXT_VERSION = ITEXT + " " + RELEASE + " by 1T3XT";
///<summary> Allows the pdf documents to be produced without compression for debugging purposes. </summary>
public static bool Compress = true;
@ -137,6 +146,13 @@ namespace iTextSharp.text {
protected float marginBottom = 0;
protected bool marginMirroring = false;
/**
* mirroring of the top/bottom margins
* @since 2.1.6
*/
protected bool marginMirroringTopBottom = false;
///<summary> Content of JavaScript onLoad function </summary>
protected string javaScript_onLoad = null;
@ -157,6 +173,9 @@ namespace iTextSharp.text {
///<summary> This is the textual part of the footer </summary>
protected HeaderFooter footer = null;
/** This is a chapter number in case ChapterAutoNumber is used. */
protected int chapternumber = 0;
// constructor
/// <summary>
@ -222,6 +241,9 @@ namespace iTextSharp.text {
throw new DocumentException("The document is not open yet; you can only add Meta information.");
}
bool success = false;
if (element is ChapterAutoNumber) {
chapternumber = ((ChapterAutoNumber)element).SetAutomaticNumber(chapternumber);
}
foreach (IDocListener listener in listeners) {
success |= listener.Add(element);
}
@ -603,6 +625,30 @@ namespace iTextSharp.text {
return open;
}
/**
* Gets the product name.
* This method may only be changed by Paulo Soares and/or Bruno Lowagie.
* @return the product name
* @since 2.1.6
*/
public static String Product {
get {
return ITEXT;
}
}
/**
* Gets the release number.
* This method may only be changed by Paulo Soares and/or Bruno Lowagie.
* @return the product name
* @since 2.1.6
*/
public static String Release {
get {
return RELEASE;
}
}
/// <summary>
/// Gets the iText version.
/// </summary>
@ -656,7 +702,7 @@ namespace iTextSharp.text {
}
/**
* Set the margin mirroring. It will mirror margins for odd/even pages.
* Set the margin mirroring. It will mirror right/left margins for odd/even pages.
* <p>
* Note: it will not work with {@link Table}.
*
@ -672,6 +718,24 @@ namespace iTextSharp.text {
return true;
}
/**
* Set the margin mirroring. It will mirror top/bottom margins for odd/even pages.
* <p>
* Note: it will not work with {@link Table}.
*
* @param marginMirroringTopBottom
* <CODE>true</CODE> to mirror the margins
* @return always <CODE>true</CODE>
* @since 2.1.6
*/
public virtual bool SetMarginMirroringTopBottom(bool marginMirroringTopBottom) {
this.marginMirroringTopBottom = marginMirroringTopBottom;
foreach (IDocListener listener in listeners) {
listener.SetMarginMirroringTopBottom(marginMirroringTopBottom);
}
return true;
}
/**
* Gets the margin mirroring flag.
*

View File

@ -165,6 +165,12 @@ namespace iTextSharp.text
/// <summary> This is a possible type of Element. </summary>
public const int IMGTEMPLATE = 35;
/**
* This is a possible type of <CODE>Element</CODE>.
* @since 2.1.5
*/
public const int JBIG2 = 36;
/// <summary> This is a possible type of <CODE>Element</CODE>. </summary>
public const int MULTI_COLUMN_TEXT = 40;

View File

@ -479,8 +479,7 @@ namespace iTextSharp.text {
*/
public virtual void SetStyle(int style) {
if (this.style == UNDEFINED) this.style = NORMAL;
this.style |= style;
this.style = style;
}
/// <summary>

View File

@ -107,6 +107,14 @@ namespace iTextSharp.text {
*/
bool SetMarginMirroring(bool marginMirroring);
/**
* Parameter that allows you to do top/bottom margin mirroring (odd/even pages)
* @param marginMirroringTopBottom
* @return true if successful
* @since 2.1.6
*/
bool SetMarginMirroringTopBottom(bool marginMirroringTopBottom); // [L6]
/// <summary>
/// Sets the page number.
/// </summary>

View File

@ -0,0 +1,67 @@
using System;
using System.IO;
/*
* $Id: BadPasswordException.java 3665 2009-01-26 22:32:15Z xlv $
*
* Copyright 2007 by Bruno Lowagie.
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text.exceptions {
/**
* Typed exception used when opening an existing PDF document.
* Gets thrown when the document isn't a valid PDF document.
* @since 2.1.5 It was written for iText 2.0.8, but moved to another package
*/
public class BadPasswordException : IOException {
/**
* Creates an exception saying the user password was incorrect.
*/
public BadPasswordException(String message) : base(message) {
}
}
}

View File

@ -0,0 +1,66 @@
using System;
/*
* $Id: IllegalPdfSyntaxException.java 3820 2009-03-25 10:30:01Z blowagie $
*
* Copyright 2009 by Bruno Lowagie.
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999-2009 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000-2009 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text.exceptions {
/**
* Typed exception used when creating PDF syntax that isn't valid.
* @since 2.1.6
*/
public class IllegalPdfSyntaxException : ArgumentException {
/**
* Creates an exception saying the PDF syntax isn't correct.
* @param message some extra info about the exception
*/
public IllegalPdfSyntaxException(String message) : base(message) {
}
}
}

View File

@ -0,0 +1,68 @@
using System;
using System.IO;
/*
* $Id: InvalidPdfException.java 3665 2009-01-26 22:32:15Z xlv $
*
* Copyright 2009 Bruno Lowagie
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999-2009 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000-2009 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text.exceptions {
/**
* Typed exception used when opening an existing PDF document.
* Gets thrown when the document isn't a valid PDF document.
* @since 2.1.5
*/
public class InvalidPdfException : IOException {
/**
* Creates an instance of a NoPdfException.
* @param message the reason why the document isn't a PDF document according to iText.
*/
public InvalidPdfException(String message) : base(message) {
}
}
}

View File

@ -0,0 +1,70 @@
using System;
/*
* $Id: UnsupportedPdfException.java 3665 2009-01-26 22:32:15Z xlv $
*
* Copyright 2009 Bruno Lowagie
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999-2009 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000-2009 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text.exceptions {
/**
* Typed exception used when opening an existing PDF document.
* Gets thrown when the document isn't a valid PDF document according to iText,
* but it's different from the InvalidPdfException in the sense that it may
* be an iText limitation (most of the times it isn't but you might have
* bumped into something that has been added to the PDF specs, but that isn't
* supported in iText yet).
* @since 2.1.5
*/
public class UnsupportedPdfException : InvalidPdfException {
/**
* Creates an instance of an UnsupportedPdfException.
* @param message the reason why the document isn't a PDF document according to iText.
*/
public UnsupportedPdfException(String message) : base(message) {
}
}
}

View File

@ -408,41 +408,8 @@ namespace iTextSharp.text.html {
if (s == null)
return null;
s = s.ToLower(CultureInfo.InvariantCulture).Trim();
Color c = (Color)WebColors.GetRGBColor(s);
if (c != null)
return c;
try {
if (s.StartsWith("#")) {
if (s.Length == 4)
s = "#" + s.Substring(1, 1) + s.Substring(1, 1)
+ s.Substring(2, 1) + s.Substring(2, 1)
+ s.Substring(3, 1) + s.Substring(3, 1);
if (s.Length == 7)
return new Color(int.Parse(s.Substring(1), NumberStyles.HexNumber));
}
else if (s.StartsWith("rgb")) {
StringTokenizer tk = new StringTokenizer(s.Substring(3), " \t\r\n\f(),");
int[] cc = new int [3];
for (int k = 0; k < 3; ++k) {
if (!tk.HasMoreTokens())
return null;
String t = tk.NextToken();
float n;
if (t.EndsWith("%")) {
n = float.Parse(t.Substring(0, t.Length - 1), System.Globalization.NumberFormatInfo.InvariantInfo);
n = n * 255f / 100f;
}
else
n = float.Parse(t, System.Globalization.NumberFormatInfo.InvariantInfo);
int ni = (int)n;
if (ni > 255)
ni = 255;
else if (ni < 0)
ni = 0;
cc[k] = ni;
}
return new Color(cc[0], cc[1], cc[2]);
}
return WebColors.GetRGBColor(s);
}
catch {
}

View File

@ -85,7 +85,7 @@ public class ChainedProperties {
// adjust the font size
String value = (String)prop[ElementTags.SIZE];
if (value != null) {
if (value.EndsWith("px")) {
if (value.EndsWith("pt")) {
prop[ElementTags.SIZE] = value.Substring(0, value.Length - 2);
}
else {

View File

@ -1,205 +1,189 @@
using System;
using System.Collections;
using System.Globalization;
using System.util;
using iTextSharp.text;
using iTextSharp.text.pdf;
using iTextSharp.text.html;
/*
* Copyright 2004 Paulo Soares
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text.html.simpleparser {
/**
*
* @author psoares
*/
public class FactoryProperties {
private FontFactoryImp fontImp = FontFactory.FontImp;
/** Creates a new instance of FactoryProperties */
public FactoryProperties() {
}
public Chunk CreateChunk(String text, ChainedProperties props) {
Font font = GetFont(props);
float size = font.Size;
size /= 2;
Chunk ck = new Chunk(text, font);
if (props.HasProperty("sub"))
ck.SetTextRise(-size);
else if (props.HasProperty("sup"))
ck.SetTextRise(size);
ck.SetHyphenation(GetHyphenation(props));
return ck;
}
private static void SetParagraphLeading(Paragraph p, String leading) {
if (leading == null) {
p.SetLeading(0, 1.5f);
return;
}
try {
StringTokenizer tk = new StringTokenizer(leading, " ,");
String v = tk.NextToken();
float v1 = float.Parse(v, System.Globalization.NumberFormatInfo.InvariantInfo);
if (!tk.HasMoreTokens()) {
p.SetLeading(v1, 0);
return;
}
v = tk.NextToken();
float v2 = float.Parse(v, System.Globalization.NumberFormatInfo.InvariantInfo);
p.SetLeading(v1, v2);
}
catch {
p.SetLeading(0, 1.5f);
}
}
public static Paragraph CreateParagraph(Hashtable props) {
Paragraph p = new Paragraph();
String value = (String)props["align"];
if (value != null) {
if (Util.EqualsIgnoreCase(value, "center"))
p.Alignment = Element.ALIGN_CENTER;
else if (Util.EqualsIgnoreCase(value, "right"))
p.Alignment = Element.ALIGN_RIGHT;
else if (Util.EqualsIgnoreCase(value, "justify"))
p.Alignment = Element.ALIGN_JUSTIFIED;
}
SetParagraphLeading(p, (String)props["leading"]);
p.Hyphenation = GetHyphenation(props);
return p;
}
public static void CreateParagraph(Paragraph p, ChainedProperties props) {
String value = props["align"];
if (value != null) {
if (Util.EqualsIgnoreCase(value, "center"))
p.Alignment = Element.ALIGN_CENTER;
else if (Util.EqualsIgnoreCase(value, "right"))
p.Alignment = Element.ALIGN_RIGHT;
else if (Util.EqualsIgnoreCase(value, "justify"))
p.Alignment = Element.ALIGN_JUSTIFIED;
}
p.Hyphenation = GetHyphenation(props);
SetParagraphLeading(p, props["leading"]);
value = props["before"];
if (value != null) {
try {
p.SpacingBefore = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
catch {}
}
value = props["after"];
if (value != null) {
try {
p.SpacingAfter = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
catch {}
}
value = props["extraparaspace"];
if (value != null) {
try {
p.ExtraParagraphSpace = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
catch {}
}
}
public static Paragraph CreateParagraph(ChainedProperties props) {
Paragraph p = new Paragraph();
CreateParagraph(p, props);
return p;
}
public static ListItem CreateListItem(ChainedProperties props) {
ListItem p = new ListItem();
CreateParagraph(p, props);
return p;
}
public Font GetFont(ChainedProperties props) {
String face = props["face"];
if (face != null) {
StringTokenizer tok = new StringTokenizer(face, ",");
while (tok.HasMoreTokens()) {
face = tok.NextToken().Trim();
if (face.StartsWith("\""))
face = face.Substring(1);
if (face.EndsWith("\""))
face = face.Substring(0, face.Length - 1);
if (fontImp.IsRegistered(face))
break;
}
}
int style = 0;
if (props.HasProperty("i"))
style |= Font.ITALIC;
if (props.HasProperty("b"))
style |= Font.BOLD;
if (props.HasProperty("u"))
style |= Font.UNDERLINE;
if (props.HasProperty("s"))
style |= Font.STRIKETHRU ;
String value = props["size"];
float size = 12;
if (value != null)
size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
Color color = Markup.DecodeColor(props["color"]);
String encoding = props["encoding"];
if (encoding == null)
encoding = BaseFont.WINANSI;
return fontImp.GetFont(face, encoding, true, size, style, color);
}
using System;
using System.Collections;
using System.Globalization;
using System.util;
using iTextSharp.text;
using iTextSharp.text.html;
using iTextSharp.text.pdf;
/*
* Copyright 2004 Paulo Soares
*
* The contents of this file are subject to the Mozilla Public License Version 1.1
* (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the License.
*
* The Original Code is 'iText, a free JAVA-PDF library'.
*
* The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
* the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
* All Rights Reserved.
* Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
* are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
*
* Contributor(s): all the names of the contributors are added in the source code
* where applicable.
*
* Alternatively, the contents of this file may be used under the terms of the
* LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
* provisions of LGPL are applicable instead of those above. If you wish to
* allow use of your version of this file only under the terms of the LGPL
* License and not to allow others to use your version of this file under
* the MPL, indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by the LGPL.
* If you do not delete the provisions above, a recipient may use your version
* of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the MPL as stated above or under the terms of the GNU
* Library General Public License as published by the Free Software Foundation;
* either version 2 of the License, or any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
* details.
*
* If you didn't download this code from the following link, you should check if
* you aren't using an obsolete version:
* http://www.lowagie.com/iText/
*/
namespace iTextSharp.text.html.simpleparser {
/**
*
* @author psoares
*/
public class FactoryProperties {
private FontFactoryImp fontImp = FontFactory.FontImp;
/** Creates a new instance of FactoryProperties */
public FactoryProperties() {
}
public Chunk CreateChunk(String text, ChainedProperties props) {
Font font = GetFont(props);
float size = font.Size;
size /= 2;
Chunk ck = new Chunk(text, font);
if (props.HasProperty("sub"))
ck.SetTextRise(-size);
else if (props.HasProperty("sup"))
ck.SetTextRise(size);
ck.SetHyphenation(GetHyphenation(props));
return ck;
}
private static void SetParagraphLeading(Paragraph p, String leading) {
if (leading == null) {
p.SetLeading(0, 1.5f);
return;
}
try {
StringTokenizer tk = new StringTokenizer(leading, " ,");
String v = tk.NextToken();
float v1 = float.Parse(v, System.Globalization.NumberFormatInfo.InvariantInfo);
if (!tk.HasMoreTokens()) {
p.SetLeading(v1, 0);
return;
}
v = tk.NextToken();
float v2 = float.Parse(v, System.Globalization.NumberFormatInfo.InvariantInfo);
p.SetLeading(v1, v2);
}
catch {
p.SetLeading(0, 1.5f);
}
}
public static void CreateParagraph(Paragraph p, ChainedProperties props) {
String value = props["align"];
if (value != null) {
if (Util.EqualsIgnoreCase(value, "center"))
p.Alignment = Element.ALIGN_CENTER;
else if (Util.EqualsIgnoreCase(value, "right"))
p.Alignment = Element.ALIGN_RIGHT;
else if (Util.EqualsIgnoreCase(value, "justify"))
p.Alignment = Element.ALIGN_JUSTIFIED;
}
p.Hyphenation = GetHyphenation(props);
SetParagraphLeading(p, props["leading"]);
value = props["before"];
if (value != null) {
try {
p.SpacingBefore = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
catch {}
}
value = props["after"];
if (value != null) {
try {
p.SpacingAfter = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
catch {}
}
value = props["extraparaspace"];
if (value != null) {
try {
p.ExtraParagraphSpace = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
}
catch {}
}
}
public static Paragraph CreateParagraph(ChainedProperties props) {
Paragraph p = new Paragraph();
CreateParagraph(p, props);
return p;
}
public static ListItem CreateListItem(ChainedProperties props) {
ListItem p = new ListItem();
CreateParagraph(p, props);
return p;
}
public Font GetFont(ChainedProperties props) {
String face = props[ElementTags.FACE];
if (face != null) {
StringTokenizer tok = new StringTokenizer(face, ",");
while (tok.HasMoreTokens()) {
face = tok.NextToken().Trim();
if (face.StartsWith("\""))
face = face.Substring(1);
if (face.EndsWith("\""))
face = face.Substring(0, face.Length - 1);
if (fontImp.IsRegistered(face))
break;
}
}
int style = 0;
if (props.HasProperty(HtmlTags.I))
style |= Font.ITALIC;
if (props.HasProperty(HtmlTags.B))
style |= Font.BOLD;
if (props.HasProperty(HtmlTags.U))
style |= Font.UNDERLINE;
if (props.HasProperty(HtmlTags.S))
style |= Font.STRIKETHRU ;
String value = props[ElementTags.SIZE];
float size = 12;
if (value != null)
size = float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo);
Color color = Markup.DecodeColor(props["color"]);
String encoding = props["encoding"];
if (encoding == null)
encoding = BaseFont.WINANSI;
return fontImp.GetFont(face, encoding, true, size, style, color);
}
/**
* Gets a HyphenationEvent based on the hyphenation entry in ChainedProperties.
* @param props ChainedProperties
@ -259,80 +243,159 @@ namespace iTextSharp.text.html.simpleparser {
return new HyphenationAuto(lang, country, leftMin, rightMin);
}
public static void InsertStyle(Hashtable h) {
String style = (String)h["style"];
if (style == null)
return;
Properties prop = Markup.ParseAttributes(style);
foreach (String key in prop.Keys) {
if (key.Equals(Markup.CSS_KEY_FONTFAMILY)) {
h["face"] = prop[key];
}
else if (key.Equals(Markup.CSS_KEY_FONTSIZE)) {
h["size"] = Markup.ParseLength(prop[key]).ToString(NumberFormatInfo.InvariantInfo) + "px";
}
else if (key.Equals(Markup.CSS_KEY_FONTSTYLE)) {
/**
* This method isn't used by iText, but you can use it to analyze
* the value of a style attribute inside a HashMap.
* The different elements of the style attribute are added to the
* HashMap as key-value pairs.
* @param h a HashMap that should have at least a key named
* style. After this method is invoked, more keys could be added.
*/
public static void InsertStyle(Hashtable h) {
String style = (String)h["style"];
if (style == null)
return;
Properties prop = Markup.ParseAttributes(style);
foreach (String key in prop.Keys) {
if (key.Equals(Markup.CSS_KEY_FONTFAMILY)) {
h["face"] = prop[key];
}
else if (key.Equals(Markup.CSS_KEY_FONTSIZE)) {
h["size"] = Markup.ParseLength(prop[key]).ToString(NumberFormatInfo.InvariantInfo) + "pt";
}
else if (key.Equals(Markup.CSS_KEY_FONTSTYLE)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("italic") || ss.Equals("oblique"))
h["i"] = null;
}
else if (key.Equals(Markup.CSS_KEY_FONTWEIGHT)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("bold") || ss.Equals("700") || ss.Equals("800") || ss.Equals("900"))
h["b"] = null;
}
else if (key.Equals(Markup.CSS_KEY_TEXTDECORATION)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("italic") || ss.Equals("oblique"))
h["i"] = null;
}
else if (key.Equals(Markup.CSS_KEY_FONTWEIGHT)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("bold") || ss.Equals("700") || ss.Equals("800") || ss.Equals("900"))
h["b"] = null;
}
else if (key.Equals(Markup.CSS_KEY_FONTWEIGHT)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("underline"))
if (ss.Equals(Markup.CSS_VALUE_UNDERLINE))
h["u"] = null;
}
else if (key.Equals(Markup.CSS_KEY_COLOR)) {
Color c = Markup.DecodeColor(prop[key]);
if (c != null) {
int hh = c.ToArgb() & 0xffffff;
String hs = "#" + hh.ToString("X06", NumberFormatInfo.InvariantInfo);
h["color"] = hs;
}
else if (key.Equals(Markup.CSS_KEY_COLOR)) {
Color c = Markup.DecodeColor(prop[key]);
if (c != null) {
int hh = c.ToArgb() & 0xffffff;
String hs = "#" + hh.ToString("X06", NumberFormatInfo.InvariantInfo);
h["color"] = hs;
}
}
else if (key.Equals(Markup.CSS_KEY_LINEHEIGHT)) {
String ss = prop[key].Trim();
float v = Markup.ParseLength(prop[key]);
if (ss.EndsWith("%")) {
v /= 100;
h["leading"] = "0," + v.ToString(NumberFormatInfo.InvariantInfo);
}
else if (Util.EqualsIgnoreCase("normal", ss)) {
h["leading"] = "0,1.5";
}
else {
h["leading"] = v.ToString(NumberFormatInfo.InvariantInfo) + ",0";
}
}
else if (key.Equals(Markup.CSS_KEY_TEXTALIGN)) {
String ss = prop[key].Trim().ToLower(System.Globalization.CultureInfo.InvariantCulture);
h["align"] = ss;
}
}
}
/**
* New method contributed by Lubos Strapko
* @param h
* @param cprops
* @since 2.1.3
*/
public static void InsertStyle(Hashtable h, ChainedProperties cprops) {
String style = (String)h["style"];
if (style == null)
return;
Properties prop = Markup.ParseAttributes(style);
foreach (String key in prop.Keys) {
if (key.Equals(Markup.CSS_KEY_FONTFAMILY)) {
h["face"] = prop[key];
}
else if (key.Equals(Markup.CSS_KEY_FONTSIZE)) {
float actualFontSize = Markup.ParseLength(cprops[ElementTags.SIZE], Markup.DEFAULT_FONT_SIZE);
if (actualFontSize <= 0f)
actualFontSize = Markup.DEFAULT_FONT_SIZE;
h[ElementTags.SIZE] = Markup.ParseLength(prop[key], actualFontSize).ToString(NumberFormatInfo.InvariantInfo) + "pt";
}
else if (key.Equals(Markup.CSS_KEY_FONTSTYLE)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("italic") || ss.Equals("oblique"))
h["i"] = null;
}
else if (key.Equals(Markup.CSS_KEY_FONTWEIGHT)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals("bold") || ss.Equals("700") || ss.Equals("800") || ss.Equals("900"))
h["b"] = null;
}
else if (key.Equals(Markup.CSS_KEY_TEXTDECORATION)) {
String ss = prop[key].Trim().ToLower(CultureInfo.InvariantCulture);
if (ss.Equals(Markup.CSS_VALUE_UNDERLINE))
h["u"] = null;
}
else if (key.Equals(Markup.CSS_KEY_LINEHEIGHT)) {
String ss = prop[key].Trim();
float v = Markup.ParseLength(prop[key]);
if (ss.EndsWith("%")) {
v /= 100;
h["leading"] = "0," + v.ToString(NumberFormatInfo.InvariantInfo);
}
else {
h["leading"] = v.ToString(NumberFormatInfo.InvariantInfo) + ",0";
}
}
else if (key.Equals(Markup.CSS_KEY_TEXTALIGN)) {
String ss = prop[key].Trim().ToLower(System.Globalization.CultureInfo.InvariantCulture);
h["align"] = ss;
}
}
}
public FontFactoryImp FontImp {
get {
return fontImp;
}
set {
fontImp = value;
}
}
public static Hashtable followTags = new Hashtable();
static FactoryProperties() {
followTags["i"] = "i";
followTags["b"] = "b";
followTags["u"] = "u";
followTags["sub"] = "sub";
followTags["sup"] = "sup";
followTags["em"] = "i";
followTags["strong"] = "b";
followTags["s"] = "s";
followTags["strike"] = "s";
}
}
else if (key.Equals(Markup.CSS_KEY_COLOR)) {
Color c = Markup.DecodeColor(prop[key]);
if (c != null) {
int hh = c.ToArgb() & 0xffffff;
String hs = "#" + hh.ToString("X06", NumberFormatInfo.InvariantInfo);
h["color"] = hs;
}
}
else if (key.Equals(Markup.CSS_KEY_LINEHEIGHT)) {
String ss = prop[key].Trim();
float actualFontSize = Markup.ParseLength(cprops[ElementTags.SIZE], Markup.DEFAULT_FONT_SIZE);
if (actualFontSize <= 0f)
actualFontSize = Markup.DEFAULT_FONT_SIZE;
float v = Markup.ParseLength(prop[key], actualFontSize);
if (ss.EndsWith("%")) {
v /= 100;
h["leading"] = "0," + v.ToString(NumberFormatInfo.InvariantInfo);
}
else if (Util.EqualsIgnoreCase("normal", ss)) {
h["leading"] = "0,1.5";
}
else {
h["leading"] = v.ToString(NumberFormatInfo.InvariantInfo) + ",0";
}
}
else if (key.Equals(Markup.CSS_KEY_TEXTALIGN)) {
String ss = prop[key].Trim().ToLower(System.Globalization.CultureInfo.InvariantCulture);
h["align"] = ss;
}
}
}
public FontFactoryImp FontImp {
get {
return fontImp;
}
set {
fontImp = value;
}
}
public static Hashtable followTags = new Hashtable();
static FactoryProperties() {
followTags["i"] = "i";
followTags["b"] = "b";
followTags["u"] = "u";
followTags["sub"] = "sub";
followTags["sup"] = "sup";
followTags["em"] = "i";
followTags["strong"] = "b";
followTags["s"] = "s";
followTags["strike"] = "s";
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -274,10 +274,15 @@ namespace iTextSharp.text.pdf {
js.Put(PdfName.JS, new PdfString(code));
}
else {
byte[] b = PdfEncodings.ConvertToBytes(code, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING);
PdfStream stream = new PdfStream(b);
stream.FlateCompress(writer.CompressionLevel);
js.Put(PdfName.JS, writer.AddToBody(stream).IndirectReference);
try {
byte[] b = PdfEncodings.ConvertToBytes(code, unicode ? PdfObject.TEXT_UNICODE : PdfObject.TEXT_PDFDOCENCODING);
PdfStream stream = new PdfStream(b);
stream.FlateCompress(writer.CompressionLevel);
js.Put(PdfName.JS, writer.AddToBody(stream).IndirectReference);
}
catch {
js.Put(PdfName.JS, new PdfString(code));
}
}
return js;
}

View File

@ -124,7 +124,7 @@ public class PdfArray : PdfObject {
*/
public PdfArray(PdfArray array) : base(ARRAY) {
arrayList = new ArrayList(array.ArrayList);
arrayList = new ArrayList(array.arrayList);
}
// methods overriding some methods in PdfObject
@ -152,6 +152,40 @@ public class PdfArray : PdfObject {
// methods concerning the ArrayList-membervalue
// ARRAY CONTENT METHODS
/**
* Overwrites a specified location of the array, returning the previous
* value
*
* @param idx The index of the element to be overwritten
* @param obj new value for the specified index
* @throws IndexOutOfBoundsException if the specified position doesn't exist
* @return the previous value
* @since 2.1.5
*/
public PdfObject SetPdfObject(int idx, PdfObject obj) {
PdfObject tmp = (PdfObject)arrayList[idx];
arrayList[idx] = obj;
return tmp;
}
/**
* Remove the element at the specified position from the array.
*
* Shifts any subsequent elements to the left (subtracts one from their
* indices).
*
* @param idx The index of the element to be removed.
* @throws IndexOutOfBoundsException the specified position doesn't exist
* @since 2.1.5
*/
public PdfObject Remove(int idx) {
PdfObject tmp = (PdfObject)arrayList[idx];
arrayList.RemoveAt(idx);
return tmp;
}
/**
* Returns an ArrayList containing <CODE>PdfObject</CODE>s.
*
@ -176,6 +210,16 @@ public class PdfArray : PdfObject {
}
}
/**
* Returns <CODE>true</CODE> if the array is empty.
*
* @return <CODE>true</CODE> if the array is empty
* @since 2.1.5
*/
public bool IsEmpty() {
return arrayList.Count == 0;
}
/**
* Adds a <CODE>PdfObject</CODE> to the <CODE>PdfArray</CODE>.
*
@ -200,14 +244,31 @@ public class PdfArray : PdfObject {
return true;
}
/**
* Adds a <CODE>PdfObject</CODE> to the <CODE>PdfArray</CODE>.
* <P>
* The newly added object will be the first element in the <CODE>ArrayList</CODE>.
*
* @param object <CODE>PdfObject</CODE> to add
*/
/**
* Inserts the specified element at the specified position.
*
* Shifts the element currently at that position (if any) and
* any subsequent elements to the right (adds one to their indices).
*
* @param index The index at which the specified element is to be inserted
* @param element The element to be inserted
* @throws IndexOutOfBoundsException if the specified index is larger than the
* last position currently set, plus 1.
* @since 2.1.5
*/
public void Add(int index, PdfObject element) {
arrayList.Insert(index, element);
}
/**
* Inserts a <CODE>PdfObject</CODE> at the beginning of the
* <CODE>PdfArray</CODE>.
*
* The <CODE>PdfObject</CODE> will be the first element, any other elements
* will be shifted to the right (adds one to their indices).
*
* @param object The <CODE>PdfObject</CODE> to add
*/
public void AddFirst(PdfObject obj) {
arrayList.Insert(0, obj);
}

View File

@ -367,6 +367,26 @@
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "iTextSharp\text\exceptions\BadPasswordException.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "iTextSharp\text\exceptions\IllegalPdfSyntaxException.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "iTextSharp\text\exceptions\InvalidPdfException.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "iTextSharp\text\exceptions\UnsupportedPdfException.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "iTextSharp\text\factories\ElementFactory.cs"
SubType = "Code"