PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Launch a .pdf from a memorystream instead of a filename
https://forum.pdfsharp.net/viewtopic.php?f=2&t=4238
Page 1 of 1

Author:  altyrocks [ Thu Feb 25, 2021 4:42 am ]
Post subject:  Launch a .pdf from a memorystream instead of a filename

In the examples to render a .pdf, it shows:

using (Process myProcess = new Process())
{
myProcess.StartInfo.FileName = fileName;
myProcess.Start();
}

This works fine when I render a document and create a file. However, I can't create files on our server so need to pass in a MemoryStream. How can this be accompished?

Author:  TH-Soft [ Thu Feb 25, 2021 10:29 am ]
Post subject:  Re: Launch a .pdf from a memorystream instead of a filename

altyrocks wrote:
However, I can't create files on our server so need to pass in a MemoryStream. How can this be accompished?
You cannot create files on the server, but you can create processes on the server? Who will see the Adobe Reader window on the server?
Are you sure you ask the right question or try the right methods?

You have to pass the PDF to Adobe Reader and I don't think AR supports MemoryStreams for this.
Your code should be able to create temporary files on the server.
But do you really want to run that code on the server?

Author:  altyrocks [ Sun Feb 28, 2021 1:20 am ]
Post subject:  Re: Launch a .pdf from a memorystream instead of a filename

The server is locked down for creating files. What I ultimately need is a Save Dialog Box to be able to generate and save the .pdf to a local computer. I'm not sure if this is possible because a server doesn't know about a user's local drive I'm assuming. This is really my first attempt at trying to use PDFsharp and MigraDoc.

Author:  TH-Soft [ Mon Mar 01, 2021 1:49 pm ]
Post subject:  Re: Launch a .pdf from a memorystream instead of a filename

The server sends the PDF to the browser - a MemoryStream is fine at this stage.

The browser will then prompt to save the file on the local computer or display it in the browser - depending on the content disposition sent by the server.
The server cannot launch the file.

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/