I am new to WPF and trying to add a PDF viewer to my WPF application, but I can't seem to figure out how to do it ... I tried following some tutorials / examples that I found on the Internet, but they do not work for me in different ways reasons ...
For example, I tried to follow the guide at: https://documentation.devexpress.com/#WPF/CustomDocument114328
to add a PDF viewer to Design Time-, he says
drag and drop PdfViewerControl from DX.15.2: Data & Analytics Toolbox tab and drag it to the main window
However, I don't seem to have a tab Data & Analyticsin the toolbox ... there is a tab there Data, but it only has items like Pointer, Chart, ListView, etc. Is there something I need to do to add / enable a toolbar Data & Analyticsin Visual Studio?
I tried to follow the tutorial at:
https://documentation.devexpress.com/#WPF/CustomDocument114329 to add a PDF Viewer via code-, it says
Open Solution Explorer, right-click Links, and select Add Link ... to add the PDF Viewer library.
Then, locate the DevExpress.Data.v15.2, DevExpress.Pdf.v15.2.Core, DevExpress.Xpf.DocumentViewer.v15.2.Core, and DevExpress.Xpf.PdfViewer.v15.2 assemblies and activate their check boxes .
Add Reference, , , "" , ...
include - - , ?
, , : http://www.codeproject.com/Articles/380019/Using-Adobe-Reader-in-a-WPF-app, :
Windows Forms . (CTRL + W, X). controls-, . , " " . " ", " COM" "Adobe PDF Reader" ( AcroPDF.DLL ).
Choose Toolbox Items COM Components, ...
- , PDF- WPF? Visual Studio 2015.
PDF , :
<Grid> PDF GUI XAML:
<StackPanel>
<Grid x:Name="browserHost" Height="300" Width="525" Margin="0,0,0,0"></Grid>
</StackPanel>
WebBrowser <Grid> # PDF , :
System.Windows.Controls.WebBrowser browser = new System.Windows.Controls.WebBrowser();
public MainWindow()
{
InitializeComponent();
try
{
browserHost.Children.Add(browser);
browser.Navigate("C:\\...\\sample.pdf");
browserHost.Opacity = 200;
}catch(Exception e)
{
Console.WriteLine("browser is visible/ not: " + browserHost.Visibility);
}
}
private void Window_Loaded_1(object sender, RoutedEventArgs e)
{
browserHost.Children.Add(browser);
}
, , , browser, , :
-
, (sample.pdf - , )...
, ? browser , ? - System.Windows.Controls.WebBrowser ?