Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4248342
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T04:14:29+00:00 2026-05-21T04:14:29+00:00

I am using iTextSharp to generate PDF out of HTML. I can save the

  • 0

I am using iTextSharp to generate PDF out of HTML. I can save the PDF file ok, but I want to handle the PDF for the OS to open it, without having to save it to disk first.
How can I do that? I am doing this from within a WPF application.

Here’s my code so far:

MemoryStream memoryStream = new MemoryStream();
TextReader reader = new StringReader(tb.Text);
Document document = new Document(PageSize.A4, 30, 30, 30, 30);
PdfWriter pdfWriter = PdfWriter.GetInstance(document, memoryStream);
HTMLWorker worker = new HTMLWorker(document);
document.Open();
worker.StartDocument();
worker.Parse(reader);
worker.EndDocument();
worker.Close();
pdfWriter.CloseStream = false;
document.Close();

How can I “materialize” memoryStream.ToArray() into a .pdf file (in memory) and send it to Windows?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T04:14:30+00:00Added an answer on May 21, 2026 at 4:14 am

    “Send to Windows” doesn’t mean anything. Only a process knows how to deal with a PDF document. Like Adobe Acrobat. A process has no use for what you store in memory, it can’t get to it. It needs a file. That’s a non-issue in Windows, when you write a file you write to memory first. The file system cache. The difference between the disk and memory is very small in Windows, an important design feature of the operating system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using iTextSharp to generate pdf in my .net application. Now I want
I'm using iTextSharp to generate PDFs for an ASP.NET application, the PDF generation seems
I'm using iTextSharp to generate some PDF files. I have two tables which have
I have a project which needs to generate PDF documents. I am using iTextSharp.
I've recently started using iTextSharp to generate PDF reports from data. It works quite
Im using ITextSharp to generate a PDF, and have a situation where a need
I am using iTextsharp to generate a PDF document from C# application. I am
I am trying to generate a PDF using iTextSharp. It will consists of a
I'm using ITextSharp to generate PDF files. Is it also possible to generate XPS
Using itextsharp (or any c# pdf library), i need to open a PDF, replace

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.