Dear iTexter,
 
I've got, so i hope, a small problem regarding the drawing of
a normal .NET Graphics object onto a pdf page. The error message
i get is "System.Drawing.Graphics can not be convert to iTextSharp.Text.Ielement"
 
I've got an array of points (Start and Endpoints of lines) which i want to get draw onto a pdf page.
My idea is to create a graphics object und use the drawlines method for it.
 
Here is my code
 
 
// Reading an existing pdf as "drawing background"
  PdfReader reader = new PdfReader("C:\\base.pdf");
  int n = reader.NumberOfPages;

  Graphics grf = null;
  pen0.Alignment = PenAlignment.Center;
  grf.SmoothingMode = SmoothingMode.AntiAlias;
  Document document = new Document();
  
  PdfWriter writer = PdfWriter.GetInstance(document, new FileStream("C:\\drawingresult.pdf",FileMode.Create));
  document.Open();
  PdfContentByte cb = writer.DirectContent;
// loop for adding any page of the base pdf into the new pdf
  for (int x=1; x<=n;x++){
  try{
   document.NewPage();
   PdfImportedPage page = writer.GetImportedPage(reader,x);
   cb.AddTemplate(page,0,0);
   int scalefactorx = (int)page.Width/700;
   pen0.Width=scalefactorx;
   grf.DrawLines(pen0,pointarray);
   document.Add(grf); //<- here comes the error ???????
   }catch(Exception ex){
            MessageBox.Show(ex.Message.ToString());
   }
  }
 
Is there anyone out there who can give me a hint? Is it possible to draw a System.Drawing.Graphics Object
onto a pdf? Is there another way to draw lines onto a pdf?
 
Hope for help and so far
 
may the force be with you
 
Oliver
 
 
 
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/itext-questions

Reply via email to