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 

invoice sample in MigraDocLite\SamplesC#\invoice

 
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
dionisof



Joined: 04 Jan 2008
Posts: 3

PostPosted: Fri Jan 04, 2008 11:46 am    Post subject: invoice sample in MigraDocLite\SamplesC#\invoice Reply with quote

Hi guys,
Happy new year.
I am new to PDFSharp so I do not know if someone has answered this.
I want to web-enable the invoice sample in the MigraDocLite directoy.
Can this be done?
I opened a new ASP web project and
imported InvoceForm.cs file.
While I have managed to compile the project I only see an empty page.

thanks
Back to top
View user's profile Send private message
Vyacheslav Popov



Joined: 23 Nov 2007
Posts: 18

PostPosted: Sun Jan 06, 2008 7:53 pm    Post subject: Reply with quote

Hi, in web application:
Code:

        protected void Page_Load(object sender, EventArgs e)
        {
            // Send PDF to browser
            MemoryStream stream = new MemoryStream();
            MyPDF.Documents.CreateAndSave(stream, false);
            Response.Clear();
            Response.ContentType = "application/pdf";
            Response.AddHeader("content-length", stream.Length.ToString());
            Response.AppendHeader("content-disposition", "attachment; filename=\"MyPDF.pdf\"");
            Response.BinaryWrite(stream.ToArray());
            Response.Flush();
            stream.Close();
            Response.End();
        }


and in you MyPDF.Documents class:
Code:

        public static void CreateAndSave(Stream stream, bool closeStream)
        {
            Document document = Documents.CreateDocument();

            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
            renderer.Document = document;

            renderer.RenderDocument();

            renderer.PdfDocument.Save(stream, closeStream);
        }
Back to top
View user's profile Send private message Visit poster's website
dionisof



Joined: 04 Jan 2008
Posts: 3

PostPosted: Mon Jan 07, 2008 9:09 am    Post subject: thanks I will try it Reply with quote

Thanks Vyacheslav
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