Hello,
if i create a new pdf, add an image from a path, and save the pdf, the aspose module try to open the image in “createFile” operation.
So, if the image is read-only (i.e. it’s stored in a network path with read-olny rights), the application raise an “access denied” exception.
Here is the code:
Aspose.Pdf.Document documento = new Aspose.Pdf.Document();
Aspose.Pdf.Page pagina = documento.Pages.Add();
pagina.PageInfo.Margin.Bottom = 0;
pagina.PageInfo.Margin.Top = 0;
pagina.PageInfo.Margin.Left = 0;
pagina.PageInfo.Margin.Right = 0;
Aspose.Pdf.Image image = new Aspose.Pdf.Image();
pagina.Paragraphs.Add(image);
image.File = “\servername\mysharedfolder\image001.tif”;
System.IO.MemoryStream outStream = new System.IO.MemoryStream()
documento.Save(outStream);
The error occurs on the last line of code.
The user running the application has access to the network path, but does not have write rights.
I’ve checked with a file-monitor and in fact the DLL tries to open the TIFF file in write… if i grant write-rights to the user, there is no error… but i really can’t do it.
DLL version is 9.0.0
By now, i’m working with a workaround, reading the TIFF file to a stream, with read-only access, and passing the stream to the Aspose DLL… here is the code:
image.ImageStream = new System.IO.FileStream("\servername\mysharedfolder\image001.tif", System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
instead of passing the file path directly.
Thank you
regards,
Andrea