Spire.PDFViewer is a powerful PDF Viewer component for .NET. It allows developers to load PDF document from stream, file and byte array.

Mon Jul 23, 2018 11:18 am

Sir,

If I use Absolute path for loading PDF file for the function PdfViewer1.LoadFromFile(fullFilePath) i doesn't work.
But it works for relative path

Code sample
string _fileLocation = @"D:\SampleDocs\Multipage.pdf";
this.PdfViewer1.LoadFromFile(_fileLocation);

File not get loaded.

pdf_viewer_error.png


Kindly help me with asulution

Thanks & Regards
Ragesh MK

ragesh
 
Posts: 4
Joined: Mon Jul 23, 2018 7:34 am

Tue Jul 24, 2018 8:33 am

Hi ragesh,

Thanks for your post.
As for the LoadFromFile method, due to the permission on website, you need to create a new folder under your project and then put the pdf you want to load into the folder.
Sapmle.jpg

Code: Select all
this.PdfViewer1.LoadFromFile(@"files/test.pdf");

If you want to load a pdf from local absolute path, you could use LoadFromStream method like below.
Code: Select all
var Path = "C:\\temp\\test.pdf";
var data = File.ReadAllBytes(Path);
var pdfStream = new MemoryStream(data);
this.PdfViewer1.LoadFromStream(pdfStream);
Sincerely,
Hogan
E-iceblue support team
User avatar

hogan.tang
 
Posts: 51
Joined: Tue Jul 03, 2018 1:43 am

Return to Spire.PDFViewer