[SOLVED] PDF Reader

Answered
0
0

I have a WiseJ PDF reader control on a window and am simply applying the filename using PdfViewer.PdfSource

All works well when it is running locally but when it is published it doesn’t populate the reader

File permissions on the server are fine – am I losing the plot?

File format is of the type c:\myfiles\filename.pdf

Any help would be appreciated – I’m sure its something simple that I am just missing.

  • Andrew Sanders
    Decided to try reading it as a memory stream and catching the file size to make sure there is actually something to display Dim file = New FileStream(FileNameandLoc, FileMode.Open, FileAccess.Read) Dim reader = New BinaryReader(file) Dim Buffer = reader.ReadBytes(file.Length) Dim mem = New MemoryStream(Buffer) MessageBox.Show(mem.Length) PdfViewer.PdfStream = mem file.Close() It is returning the correct memory size for each pdf in the folder but PdfViewer.PdfStream = mem displays nothing. Very confusing….
  • You must to post comments
Best Answer
0
0

SOLVED-

The problem was the X-Frame option was set to DENY

Easy fix in the web config….

<system.webServer>

<httpProtocol>
<customHeaders>
<clear />
<add name=”X-Frame-Options” value=”sameorigin” />
</customHeaders>
</httpProtocol>


</system.webServer>

 

Luca – Thanks for putting me on the right track

 

  • You must to post comments
0
0

Hi Andrew,

please refer to this discussion, it should put you on the right track:

https://wisej.com/support/question/pdf-viewer-question

Best regards
Frank

  • Andrew Sanders
    Thanks Frank I’m not sure that does really answer the issue Surely I should be able to allocate a valid pdf file (that is located on the same server as the application) to the pdfsource of the pdfviewer Or having returned the data as a memory stream to just allocate it to the pdfstream property I’ve checked in the developer tools on Chrome on the live app and it is returning postback.wx which I believe is the physical file that is used (when I click on it it displays the correct pdf in another tab) Thanks for the help!
  • Andrew Sanders
    Also, why would it work fine locally but not on the live version
  • Luca (ITG)
    Which pdf viewer type (default, mozilla, …) are you using?
  • Luca (ITG)
    Also check in Chrome with F12 to see if there is a CORS error in the console.
  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.