Just write the pdf into browser directly

Technical support for Spire.PDF

Moderator: iceblue support

Just write the pdf into browser directly

Postby amy.zhao » Mon Sep 03, 2012 6:47 am

Question: Just write the pdf into browser directly and donot load it from any file, please give a solution.

Solution:
Code: Select all
         //write converted pdf to browser directly
         PdfDocument doc = new PdfDocument();
         Thread thread = new Thread(() =>
        { doc.LoadFromHTML("http://www.google.com/", true, true, true); });
        thread.SetApartmentState(ApartmentState.STA);
        thread.Start();
        thread.Join();
        doc.SaveToHttpResponse("sample.pdf", Response, HttpReadType.Open);
        doc.Close();
User avatar
amy.zhao
 
Posts: 2225
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.PDF

Who is online

Users browsing this forum: No registered users and 0 guests