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