|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
Placing Image over an Image In a table in a PDF Using ItextsharpI want to create a PDF document using ItextSharp dll.
In that PDF, I want to place an image say A over an image say B in a table. When I tried the image A is place under the Image B so it is not visible properly I want to place image A over B. The code I write is place below. Document document = new Document(pageSize); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream ("C:\\man\\headerTable.pdf", FileMode.Create)); document.Open(); string[] paramer ={"Game Intelligence:","Sense of Game Reality:","Emotional Game Control:","Ability to Discern Goodfrom :","Overall Attitude toward Sports:","Understanding Others:", "Interpersonal Rapport:","Interpersonal Harmony:","Interpersonal Conflict:","Underst Practical Team Action:","Team Orientation:","Attitude toward Team Success:" ,"Attitude toward Team Failure:","Discipline, Rules, & Game Plan :","Attitude toward Authority:", "Attitude toward Compliance Benefits ","Attitude toward Rule-breaking:","Understanding Self Worth:","Sense of Self Reality:", "Emotional self control:","Ability to Discern Personal Good from Bad:","Overall Self Attitude:","Awareness of Self-worth:", "Desire for Self Development:","Developing Personal Potential (attitude):","Insight into Personal Problems (attitude):", "Game Role Awareness:","Game-role Satisfaction:","Attitude toward Peak Performance:","Attitude toward Poor Performance:", "Sports Self-Identity:","Mental Toughness (Discipline, Energy and Drive):","Understanding Self Worth:","Attitude toward Personal Growth:", "Attitude toward Personal Regression:","Intuition:","Concentration:","Stress Tension Indicator:","Stress Resistance:"}; PdfPTable table = new PdfPTable(3); table.DefaultCell.Padding = 3; float[] headerwidths = { 3, 7, 11 }; // percentage table.SetWidths(headerwidths); table.WidthPercentage = 100; // percenta table.DefaultCell.BorderWidth = 2; table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; for ( int i = 0; i < 37; i++) { if (i == 15 || i == 30) { document.Add(table); str = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "mark.jpg"; Image png = Image.GetInstance(str); png.SetAbsolutePosition(350f, 498f); document.Add(png); document.NewPage(); table = new PdfPTable(3); table.DefaultCell.Padding = 3; table.SetWidths(headerwidths); table.WidthPercentage = 100; // percentage table.DefaultCell.BorderWidth = 2; table.DefaultCell.HorizontalAlignment = Element.ALIGN_CENTER; } phrase2 = new Phrase(paramer[i], FontFactory.GetFont (FontFactory.TIMES, 10, Font.BOLD, new Color(0, 0, 0))); phrase1 = new Phrase((i + 1).ToString(), FontFactory.GetFont (FontFactory.TIMES, 10, Font.BOLD, new Color(0, 0, 0))); cell = new PdfPCell(); cell.AddElement(phrase1); table.AddCell(cell); cell = new PdfPCell(); cell.AddElement(phrase2); table.AddCell(cell); str = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + "grf.jpg"; img = Image.GetInstance(str); cell = new PdfPCell(); cell.AddElement(img); table.AddCell(cell); } document.Add(table); document.Close(); please help me to solve this |
|
|
Re: Placing Image over an Image In a table in a PDF Using Itextsharp1. Do you realize you are creating a separate instance of the mark.jpg for each page and a separate instance of grf.jpg for each cell? You should create those instances ONCE and reuse them on each page. It will make a smaller JPG file.
2. Apparently you wanted mark.jpg to show over top of the entire page, like a watermark. The recommended way to do that is with a PageEvent; in that page event, instead of adding to the Document, you would add the Image instance directly to the writer.DirectContentOver stream. But you can also do that without the PageEvent if you'd rather. Image png = Image.GetInstance(str); png.SetAbsolutePosition(350f, 498f); // document.Add(png); writer.DirectContent.AddImage(png); document.NewPage(); table = new PdfPTable(3); On Wed, Jun 25, 2008 at 5:37 PM, Manoop <manoop@...> wrote:
------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: Placing Image over an Image In a table in a PDF Using ItextsharpSorry; I said DirectContentOver but the correct property to use is writer.DirectContent, as shown in the code.
On Thu, Jun 26, 2008 at 2:01 PM, Ross Presser <rpresser@...> wrote: 1. Do you realize you are creating a separate instance of the mark.jpg for each page and a separate instance of grf.jpg for each cell? You should create those instances ONCE and reuse them on each page. It will make a smaller JPG file. ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
Re: Placing Image over an Image In a table in a PDF Using Itextsharpok I read your replay my problem is not that i want to draw a line through the table when i tried it the line over the images was gone under the image the pdf want is like this ![]()
|
|
|
Re: Placing Image over an Image In a table in a PDF Using ItextsharpYou're not making any sense. Your code isn't talking about drawing any lines at all; only placing images, tables and text. I assumed that you wanted to place one image over top of the table. My equivalent code, which uses writer.DirectContent, is doing that.
You want more help, make more sense. Provide all of the images used in your code. Provide code that outputs the problem PDF and provide the problem PDF itself. And stop double-posting to the list.
On Fri, Jun 27, 2008 at 12:56 PM, Manoop <manoop@...> wrote:
Loading image Click anywhere to cancel Image unavailable ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
|
|
open encrypted pdfsHello,
i use itextsharp to create pdfs this works perfect. Does anybody on this group has experience with opening encrypted pdfs? We create encrypted pdfs within our software and we want our user only to view the pdfs within our software. So I look for an pdf viewer which is able to provide an password to the pdf. We don't like to ask the user every time for an password so the software should be able to provide the password to the viewer. Thanks in advance jochen ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ itextsharp-questions mailing list itextsharp-questions@... https://lists.sourceforge.net/lists/listinfo/itextsharp-questions |
| Free Forum Powered by Nabble | Forum Help |