PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index PDFsharp - moved to http://forum.pdfsharp.net/
Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Cant create PDF from my Webproject

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/
View previous topic :: View next topic  
Author Message
danbli



Joined: 10 Feb 2008
Posts: 1

PostPosted: Sun Feb 10, 2008 10:34 pm    Post subject: Cant create PDF from my Webproject Reply with quote

Hello!

I've tried to create a PDF from my webpage project by including the DLL and everything works fine with the compiling and that but when running the project i get "You cannot draw on a page that is not owned by a PdfDocument object.".

This comes from XGraphics.cs
if (page.Owner == null)
throw new ArgumentException("You cannot draw on a page that is not owned by a PdfDocument object.", "page");

Iv'e tried a normal console application and there everythin workes fine.
I've also enabled the attribute write on the webapplication in Internet Information Server.

My code looks like this.
using System;
using System.Data;
using System.Diagnostics;
using System.IO;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using PdfSharp;
using PdfSharp.Pdf;
using PdfSharp.Drawing;
using PdfSharp.Pdf.IO;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
PdfDocument dokument = new PdfDocument();
PdfPage sida = new PdfPage();
XGraphics grafik = XGraphics.FromPdfPage(sida);
XFont font = new XFont("Verdana", 20, XFontStyle.Bold);
grafik.DrawString("Hello, World!", font, XBrushes.Black, new XRect(0, 0, sida.Width, sida.Height),XStringFormat.Center);

string filename = "HelloWorld.pdf";
dokument.Save(filename);
Process.Start(filename);
}
}
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    PDFsharp - moved to http://forum.pdfsharp.net/ Forum Index -> Support - moved to http://forum.pdfsharp.net/ All times are GMT
Page 1 of 1

 
Jump to:  
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 vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own YouTube Clone

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com