Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Sun Dec 15, 2019 7:58 pm

Hello,
in this moment i use the free version of Spire.Pdf

If i open a existing File with
Code: Select all
Dim doc As New PdfDocument()
        If System.IO.File.Exists(FileNameAndPath) Then doc.LoadFromFile(FileNameAndPath) Else Return False

and I get an error message because the component tries to write to the program path.
Der Zugriff auf den Pfad "C:\Program Files (x86)\PlanMass\H1_GRUNDRISS EG.pdf" wurde verweigert.


How can i solve this?

Sincerely Christian

Bazi_101
 
Posts: 9
Joined: Sun Sep 29, 2019 4:40 pm

Mon Dec 16, 2019 6:00 am

Hi,

Thanks for your inquiry.
Please make sure you have permission to access the path. If there is still the issue, please provide your input file for further investigation.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Dec 16, 2019 6:31 am

Hello Betsy,
Thank you for your answer.
My problem is not access to the PDF document, I have access to this path.
The error message comes because the Spire.PDf-Dll writes a copy of the file to be opened into the program path. Of course, the program has no write rights there.
I cannot assign this for the program path either.

Greetings Christian

Bazi_101
 
Posts: 9
Joined: Sun Sep 29, 2019 4:40 pm

Mon Dec 16, 2019 6:59 am

Hi,

I tested your case with the latest Spire.PDF Pack(Hot Fix) Version:5.12.15, but didn't reproduce your issue. Please first try to use the version. Besides, you could try to load file via stream.
Code: Select all
            FileStream stream = File.OpenRead(FilePath + "sample.pdf");
            PdfDocument doc = new PdfDocument();
            doc.LoadFromStream(stream);


Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Dec 16, 2019 8:02 am

Hello Betsy,
I found the bug elsewhere in my code.
Since my given directory for saving did not exist, the program directory was accessed.

Greetings Christian

Bazi_101
 
Posts: 9
Joined: Sun Sep 29, 2019 4:40 pm

Mon Dec 16, 2019 8:19 am

HI,

Glad to hear that you have solved your issue.
If there is any question while using our produce, please feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF

cron