Convert the PDF file into base64 string and pass it to the webbrowser control
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (locateText.Text.EndsWith("pdf", true, null) == true && | |
File.Exists(locateText.Text) == true) | |
{ | |
var buffer = File.ReadAllBytes(locateText.Text); | |
// Document.InvokeScript seems not understanding the Blob type | |
//object[] args = { fileBytes }; | |
//webBrowser1.Document.InvokeScript("PDFViewerApplication.open", args); | |
// so convert it to base64 and pass it | |
var asBase64 = Convert.ToBase64String(buffer); | |
webBrowser1.Document.InvokeScript("openPdfAsBase64", new[] { asBase64 }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment