View previous topic :: View next topic |
Author |
Message |
gloups
Joined: 24 Jan 2009 Posts: 1
|
Posted: Sat Jan 24, 2009 3:01 pm Post subject: Simply create arrays |
|
|
Hello,
I'm currently using PdfSharp in order to create a bill generator for a software. However, I don't found how to display an array.
Could somebody give me a short sample code ?
I've tried this:
Code: |
PdfArray array = new PdfArray(document);
try
{
array.Elements.Add(new PdfString("Article"));
array.Elements.Add(new PdfString("Prix"));
}
catch (ArgumentException e)
{
System.Console.WriteLine(e.Message);
}
|
But id does not work.
Thank you very much by advance. |
|
Back to top |
|
 |
Soldier-B

Joined: 14 Oct 2008 Posts: 16 Location: USA
|
Posted: Mon Jan 26, 2009 3:01 pm Post subject: |
|
|
The PdfArray class is used to represent data stored in an array (in a pdf document) based on the pdf spec, not as a normal data structure. So when I look at the code sample you provided this is what I see:
Code: |
// create a new "pdfarray" in "document"
PdfArray array = new PdfArray(document);
try
{
// add 2 new string elements to "array"
array.Elements.Add(new PdfString("Article"));
array.Elements.Add(new PdfString("Prix"));
}
catch (ArgumentException e)
{
System.Console.WriteLine(e.Message);
}
|
Here's a link to the PDFsharp sample page for the "Hello World" sample: http://pdfsharp.com/PDFsharp/index.php?option=com_content&task=view&id=15&Itemid=29
It shows how to output text to a pdf document. Also you might want to take a look at the MigraDoc library too, it may suite your needs better.
Link to MigraDoc + PDFsharp sample: http://pdfsharp.com/PDFsharp/index.php?option=com_content&task=view&id=55&Itemid=63 |
|
Back to top |
|
 |
|