PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 11, 2024 8:20 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: Web server permissions?
PostPosted: Mon Aug 02, 2010 2:26 am 
Offline

Joined: Mon Aug 02, 2010 2:06 am
Posts: 6
I have an application that overlays a PDF stream of text (from XtraReports) over a PDF image of a form letter (an official form provided to us). This works fine in development, but hangs on the server. That leads me to believe that this is a permissions problem. I've ensured that my machine web.config is setup for full trust on the server. I've also moved the source PDF to different locations on the file system to ensure this isn't a file permissions issue. IIS never throws an error, it just chugs on and on until I kill the request. Any idea what could be causing this?

Thanks!


Top
 Profile  
Reply with quote  
PostPosted: Wed Aug 04, 2010 11:03 pm 
Offline

Joined: Mon Aug 02, 2010 2:06 am
Posts: 6
For the record, I was not able to get this to work after a full day of banging my head against my desk and my clients asking why it wasn't done yet.

I found that iTextSharp did what I needed, but also seems to have a much more robust group of folks supporting it. If anyone else is struggling to get PDFSharp to work while the developers are on vacation, you may want to check out http://itextpdf.com/.


Top
 Profile  
Reply with quote  
PostPosted: Fri Aug 06, 2010 9:59 am 
Offline

Joined: Fri Mar 19, 2010 3:00 pm
Posts: 3
Do you develop open source solution? If not, then you should read the license:
"You can be released from the requirements of the license by purchasing a commercial license. Buying such a license is mandatory as soon as you develop commercial activities involving the iText software without disclosing the source code of your own applications. These activities include: offering paid services to customers as an ASP, serving PDFs on the fly in a web application, shipping iText with a closed source product."


I got this from them when asking for the license fees (and this is the reason thy I said "good bye" to ITextSharp...):

iText Hosted Licenses
You would implement an iText Hosted License if you are planning to implement iText in an internal or external web-based solution to allow many users to access the functionality of the software. An example solution would be dynamic generation of PDF invoices for your on-line billing application.

iText Commercial SaaS/ASP/Hosted Server licensing
· Annual subscription
· Support included (Annual incidents based on volume)
· IP (Intellectual Property) protection
· Upgrade from level to level allowed during the year @ 20% charge
· Requires quarterly reporting of end users unless choosing unlimited option (100,000+)
· An "end user" is defined as a subscriber to the application, or if the system is open to the general community an "end user" is the end recipient of a document either generated or processed by the application for a monthly rate

Price; End User Limit; Support Incidents
$1,500; Single application for up to 2,500 end users; 1
$2,000; Single application for 2,501-5,000 end users; 1
$2,500; Single application for 5,001-10,000 end users; 1
$5,000; Single application for 10,001-100,000 end users; 2
$12,500; Single application for 100,000+ end users; 4


Top
 Profile  
Reply with quote  
PostPosted: Wed Oct 13, 2010 6:41 pm 
Offline

Joined: Mon Aug 02, 2010 2:06 am
Posts: 6
Good lord, that is insane! Thanks for the heads up!

Does anyone have a clue on my issue, then? I left the PDFSharp code commented out, so I could certainly come back if it works.

Assuming it's related to permissions, is there any ETA for medium trust functionality? I know we're not running in medium trust, but it might be related, nonetheless... I notice the latest release is almost a year old, which is makes me mildly concerned that it won't be fixed any time soon.


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 14, 2010 7:44 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
habajaba wrote:
Assuming it's related to permissions, is there any ETA for medium trust functionality?

No, there isn't yet.

If you think this is a permissions problem, have you tried creating an Application Pool with identity Local System for a test?
Moving a file to a new location won't help if the new location has the same permissions as the old location.
Are you sure the file can be found? ASPX gets compiled by the server and the assemblies are not in the directy where you expect them and relative paths may not work.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 14, 2010 12:51 pm 
Offline

Joined: Mon Aug 02, 2010 2:06 am
Posts: 6
Thanks for the reply, Thomas.

The reason I believe it's a permissions issue, is that the code ran on dev and test servers without issue. The file paths are fine, as the equivalent iTextSharp code works fine when supplied the exact same stream and watermark pdf file.

What's really strange to me is that the output just hangs at a white screen forever. No server timeout, no nothing. If there are no logical reasons for this to happen.... I might give it another go this weekend. This is a production server, so I can't do much to test on it during the week.

Here's the code I came up with. Maybe you could look it over and give me a sanity check?
Code:
                Dim oPDFReport As PdfDocument = PdfReader.Open(oStream)
                Dim oWatermarkDR As cReportWatermarkDR

                For Each oWatermarkDR In colReportWatermarkList
                    Dim oPDFWatermark As XPdfForm = XPdfForm.FromFile(oWatermarkDR.FilePath)

                    If oWatermarkDR.PageNum = k_iNull_Numeric Then 'no page specified, watermark all
                        Dim iPage As Int16

                        For iPage = 0 To oPDFReport.Pages.Count - 1
                            Dim oPage As PdfPage = oPDFReport.Pages(iPage)
                            Dim gfx As XGraphics = XGraphics.FromPdfPage(oPage, XGraphicsPdfPageOptions.Append)

                            gfx.DrawImage(oPDFWatermark, New XRect(0, 0, oPage.Width, oPage.Height))
                        Next
                    Else 'watermark only a specific page
                        Dim oPage As PdfPage = oPDFReport.Pages(oWatermarkDR.PageNum - 1)
                        Dim gfx As XGraphics = XGraphics.FromPdfPage(oPage, XGraphicsPdfPageOptions.Append)

                        gfx.DrawImage(oPDFWatermark, New XRect(0, 0, oPage.Width, oPage.Height))
                    End If

                Next
                oPDFReport.Save(oStream, False)


Top
 Profile  
Reply with quote  
PostPosted: Thu Oct 14, 2010 3:35 pm 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3101
Location: Cologne, Germany
If you don't know where it hangs, how about writing "Step 1", "Step 2", etc. to e. g. "C:\report.log", maybe along with a timestamp (don't forget to flush after each line).

Old fashioned way ...

When you know at which line the server hangs, then we'll start guessing again.

Code:
                For Each oWatermarkDR In colReportWatermarkList
                    Dim oPDFWatermark As XPdfForm = XPdfForm.FromFile(oWatermarkDR.FilePath)
MyLogger "#1 " + oWatermarkDR.FilePath
                    If oWatermarkDR.PageNum = k_iNull_Numeric Then 'no page specified, watermark all
                        Dim iPage As Int16
MyLogger "#2"
                        For iPage = 0 To oPDFReport.Pages.Count - 1
                            Dim oPage As PdfPage = oPDFReport.Pages(iPage)
MyLogger "#3"
etc. etc. etc.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
PostPosted: Wed Jul 20, 2011 11:09 am 
Offline

Joined: Wed Jul 20, 2011 10:59 am
Posts: 2
I'm sure you're still not looking for a solution for this, but to help others that might come across this problem (as I did) I thought I'd post my solution.

I re-compiled the PDFsharp (1.30) as Release not Debug, as I recalled seeing this problem somewhere else while looking for something unrelated. I re-released the dll to my site and it worked.

For whatever reason, the page was hanging, but not timing out or killing the server in an infinite loop. I found that the code was hanging when I tried to call XGraphics.DrawString.

NB: To be able to compile you need to change 'Treat warnings as errors' from 'All' to 'None'. This can be found in Properties -> Build.


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 23 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