| PDFsharp & MigraDoc Forum https://forum.pdfsharp.net/ |
|
| OutofMemoryException error https://forum.pdfsharp.net/viewtopic.php?f=2&t=2727 |
Page 1 of 1 |
| Author: | HetalPatel [ Sat Feb 01, 2014 12:35 am ] | ||
| Post subject: | OutofMemoryException error | ||
Hi there, Please see attached image regarding to previous post now I am getting new error for "outofmemoryexception" Please help me on this ASAP. I have dead line to fix this issue till Monday. Your help would be greatly appreciated.
|
|||
| Author: | Thomas Hoevel [ Mon Feb 03, 2014 10:28 am ] |
| Post subject: | Re: OutofMemoryException error |
Hi! Which build? WPF or GDI+? Does the other build work? |
|
| Author: | HetalPatel [ Mon Feb 03, 2014 6:19 pm ] |
| Post subject: | Re: OutofMemoryException error |
Hi Thomas, Thanks for response. have you seen my previous post. I had entered my original code. that is GDI. Hetal |
|
| Author: | Thomas Hoevel [ Tue Feb 04, 2014 9:08 am ] |
| Post subject: | Re: OutofMemoryException error |
Try WPF build (IIRC the GDI+ build does not work on all servers). |
|
| Author: | HetalPatel [ Tue Feb 04, 2014 7:19 pm ] | ||
| Post subject: | Re: OutofMemoryException error | ||
Hi Thomas, I changed build to WPF still am getting an error, please see and attachment.
|
|||
| Author: | Thomas Hoevel [ Wed Feb 05, 2014 9:02 am ] |
| Post subject: | Re: OutofMemoryException error |
Well, you're trying to launch Adobe Reader on the Cloud server - but nobody will be able to see it anyway. Instead, return the PDF to the client. See also: http://www.pdfsharp.net/wiki/Clock-sample.ashx |
|
| Author: | HetalPatel [ Thu Feb 06, 2014 12:06 am ] | ||
| Post subject: | Re: OutofMemoryException error | ||
Thank you Thomas, Help on this is greatly appreciated. It is working fine in my local test. But still I am getting error. Please see attachment. Below is my code line where I am getting this error. Code: PdfDocument document = new PdfDocument();
document.Info.Title = "A sample invoice"; document.Info.Subject = "Demonstrates how to create an invoice."; document.Info.Author = "Stefan Lange"; // Create an empty page PdfPage page = document.AddPage(); [color=#408040] // Get an XGraphics object for drawing XGraphics gfx = XGraphics.FromPdfPage(page); //This line has an error [/color] //XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always); // Create a font XFont font = new XFont("Times New Roman", 14, XFontStyle.BoldItalic); gfx.DrawString(footer, new XFont("Times New Roman", 8, XFontStyle.BoldItalic), XBrushes.Black, x, y, XStringFormats.TopLeft); MemoryStream stream = new MemoryStream(); document.Save(stream, false); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); stream.Close(); Response.End();
|
|||
| Author: | Thomas Hoevel [ Thu Feb 06, 2014 9:09 am ] |
| Post subject: | Re: OutofMemoryException error |
HetalPatel wrote: But still I am getting error. I'm sorry for repeating myself: use the WPF build, not the GDI+ build.
|
|
| Author: | HetalPatel [ Thu Feb 06, 2014 11:18 pm ] |
| Post subject: | Re: OutofMemoryException error |
Thank you very Much for your great help on this issue. My issue is Resolved now. Actually I forget to put back WPF references while I am testing. |
|
| Author: | HetalPatel [ Fri Feb 07, 2014 12:42 am ] |
| Post subject: | Re: OutofMemoryException error |
Hello Thomas, Here is one more help I need from you. Right now my pdf is open in current windows. How can I open it in new windows? How can I replace it with JavaScript function? Below is my code Code: MemoryStream stream = new MemoryStream();
document.Save(stream, false); Response.Clear(); Response.ContentType = "application/pdf"; Response.AddHeader("content-length", stream.Length.ToString()); Response.BinaryWrite(stream.ToArray()); Response.Flush(); // stream.Close(); Response.End(); |
|
| Author: | () => true [ Sun Feb 09, 2014 9:42 pm ] |
| Post subject: | Re: OutofMemoryException error |
Hi! The HTML page that links to the PDF file (or the ASP.NET page that returns the PDF) can tell the browser to open it in a new window. Not my area of expertise, but I think the ASP.NET code that returns the PDF cannot do much about it. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |
|