PDFsharp & MigraDoc Forum

PDFsharp - A .NET library for processing PDF & MigraDoc - Creating documents on the fly
It is currently Mon Nov 03, 2025 8:56 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules

Also see our new Tailored Support & Services site.



Post new topic Reply to topic  [ 11 posts ] 
Author Message
PostPosted: Sat Feb 01, 2014 12:35 am 
Offline

Joined: Fri Jan 31, 2014 10:47 pm
Posts: 8
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.


Attachments:
outofmemoryexceptionpdf.png
outofmemoryexceptionpdf.png [ 46.68 KiB | Viewed 13423 times ]
Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 03, 2014 10:28 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
Hi!

Which build? WPF or GDI+?
Does the other build work?

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Mon Feb 03, 2014 6:19 pm 
Offline

Joined: Fri Jan 31, 2014 10:47 pm
Posts: 8
Hi Thomas,
Thanks for response.

have you seen my previous post.
I had entered my original code.

that is GDI.

Hetal


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 04, 2014 9:08 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
Try WPF build (IIRC the GDI+ build does not work on all servers).

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Tue Feb 04, 2014 7:19 pm 
Offline

Joined: Fri Jan 31, 2014 10:47 pm
Posts: 8
Hi Thomas,

I changed build to WPF

still am getting an error, please see and attachment.


Attachments:
accessdennieerrorforpdf1.png
accessdennieerrorforpdf1.png [ 36.88 KiB | Viewed 13399 times ]
Top
 Profile  
Reply with quote  
PostPosted: Wed Feb 05, 2014 9:02 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
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

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 06, 2014 12:06 am 
Offline

Joined: Fri Jan 31, 2014 10:47 pm
Posts: 8
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();


Attachments:
OUTOFMEMORY.png
OUTOFMEMORY.png [ 172.81 KiB | Viewed 13389 times ]
Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 06, 2014 9:09 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3136
Location: Cologne, Germany
HetalPatel wrote:
But still I am getting error.
I'm sorry for repeating myself: use the WPF build, not the GDI+ build.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Feb 06, 2014 11:18 pm 
Offline

Joined: Fri Jan 31, 2014 10:47 pm
Posts: 8
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. :D


Top
 Profile  
Reply with quote  
PostPosted: Fri Feb 07, 2014 12:42 am 
Offline

Joined: Fri Jan 31, 2014 10:47 pm
Posts: 8
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();


Top
 Profile  
Reply with quote  
PostPosted: Sun Feb 09, 2014 9:42 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 355
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.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC


Who is online

Users browsing this forum: Baidu [Spider] and 94 guests


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 post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group