PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Mon May 13, 2024 4:10 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Simply create arrays
PostPosted: Sat Jan 24, 2009 3:01 pm 
Offline

Joined: Sat Jan 24, 2009 2:46 pm
Posts: 1
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.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jan 26, 2009 3:01 pm 
Offline
User avatar

Joined: Tue Oct 14, 2008 6:15 pm
Posts: 32
Location: USA
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


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 97 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group