PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Sun Jun 16, 2024 4:19 am

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Thu Nov 20, 2014 5:47 pm 
Offline

Joined: Thu Feb 13, 2014 7:09 pm
Posts: 13
Hey there,

We are experiencing issues when manipulating a PDF using PdfSharp and trying to save to a network location. We have no problem saving to the current user's temporary files. I have reviewed the security privileges against the destination folder for the user which is executing the command, and that user has Full Access privileges against that folder. Is it possible that PdfSharp would be aliasing or running under a different user account than the user account which is executing the code?

Snippet of particular code causing issue:
Code:
            ' add the drawing PDF as an image to the section... first we need to determine the orientation, and if landscape, rotate it...
            Dim img As PdfSharp.Drawing.XImage = PdfSharp.Drawing.XImage.FromFile(i.DrawingFilePath)

            ' compare the width to height... if width is greater than height we are dealing with landscape...
            If img.PixelWidth > img.PixelHeight Then
                ' we're dealing with a landscape...
                Dim pdfDoc As PdfSharp.Pdf.PdfDocument = Nothing
                Dim newSaveString As String = String.Empty

                pdfDoc = PdfSharp.Pdf.IO.PdfReader.Open(i.DrawingFilePath)

                For Each p As PdfSharp.Pdf.PdfPage In pdfDoc.Pages
                    p.Rotate = 270
                    p.Orientation = PdfSharp.PageOrientation.Landscape
                    p.Size = PdfSharp.PageSize.Letter
                Next

                newSaveString = i.DrawingFilePath.Replace(".pdf", "") + "_2.pdf"

                SalLogger.Debug("DrawingPrinterConfiguratorView.PrintDrawings() attempting to resave landscape PDF file. NewSaveString='" + newSaveString + "'.")

                pdfDoc.Save(newSaveString)

                migraImage = migraSection.AddImage(newSaveString)

            Else
                migraImage = migraSection.AddImage(i.DrawingFilePath)

            End If


Top
 Profile  
Reply with quote  
PostPosted: Thu Nov 20, 2014 8:24 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 341
Hi!

If the user can copy files to that folder using Explorer, then AFAIK s/he should also be able to save files there using PDFsharp/MigraDoc.
Did you try this?

You have to check disk permissions and share permissions.

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


Top
 Profile  
Reply with quote  
PostPosted: Fri Nov 21, 2014 2:51 pm 
Offline

Joined: Thu Feb 13, 2014 7:09 pm
Posts: 13
I was adamant that the security was set up correctly - I was mistaken.

I reviewed the physical folder securities extensively and did effective permission analysis for the given user - everything added up. However your post reminded me that the network share itself has security permissions against it. Sure enough, after review, I found that the developers active directory group was added to the share along other service accounts associated in this process; however the user executing the code was not. After adding in the domain users group to this folder for security, everything started working. Makes sense now why I (a developer) could execute this without issue while consumers of the system could not.

Thanks for jogging my mind!


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 155 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