I am trying to open a PDF fiile and use one of it's pages as a template page for new PDF document call newDoc. I open the orginal PDF document a get the template page without a problem. I than add the template page to newDoc via page = newDoc.AddPage(inDoc.Pages[0]); This works fine.. I than get a gfx object for the page which is used to modify the newDoc page. However, As soon as i go to use the newly created gfx object to write a string to the newDoc i get a Assert Failure Error in PdfObjects Line75.
Any Help would be great!.
I am using PDFSharpClock project with VS2008...
Code:
// Get a fresh copy of the sample PDF file
string filename = "C:\\audiencefinder_countsummary.pdf";
// Reads document into memory for modification
PdfDocument inDoc = PdfReader.Open(filename, PdfDocumentOpenMode.Import);
PdfDocument newDoc = new PdfDocument();
this.time = newDoc.Info.CreationDate;
newDoc.Info.Title = "Audience Finder";
// Adds the template PDF page to the newDoc PDF document
page = newDoc.AddPage(inDoc.Pages[0]);
gfx = XGraphics.FromPdfPage(page. XGraphicsPdfPageOptions.Append);
font_reg = new XFont("Arial", 10, XFontStyle.Regular);
font_bold = new XFont("Arial", 10, XFontStyle.Bold);
brush_blk = new XSolidBrush(XColors.Black);
// Create a font
XFont font = new XFont("Arial", 10, XFontStyle.Bold);
XBrush brush = new XSolidBrush(XColors.Black);
string test = "Jan 25, 2011 10:27AM";
gfx.DrawString(test, font, brush, 500, 123);