We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Aspose.Pdf .Net - Add image to pdf

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();
image.File = “\servername\mysharedfolder\image001.tif”;
System.IO.MemoryStream outStream = new System.IO.MemoryStream()

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


Hi Andrea,

for using our API’s.<o:p></o:p>

I have tested the scenario and I am able to notice the same problem. For the sake of correction, I have logged this problem as PDFNEWNET-36715 in our issue tracking system. We will further look into the details of this problem and will keep you updated on the status of correction. Please be patient and spare us little time. We are sorry for this inconvenience.

The issues you have found earlier (filed as PDFNEWNET-36715) have been fixed in Aspose.Pdf for .NET 9.2.0.

The blog post for this release is created over this link

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.