PDFsharp & MigraDoc Foundation
https://forum.pdfsharp.net/

Loading pdf file on Win Form
https://forum.pdfsharp.net/viewtopic.php?f=2&t=1472
Page 1 of 1

Author:  peterposnag [ Fri Dec 10, 2010 5:27 pm ]
Post subject:  Loading pdf file on Win Form

Hi,
Could anybody tell me how to show a pdf file on a win-form without use webbrowser control?
I already tried with the sample pdf-preview but I always get the same error, it's related to the pdfsharp.viewing.dll library.
Where can I find this library?
if you need more details please, just ask me.
Thank in advance.
Peter

Author:  jeffhare [ Tue Dec 14, 2010 3:26 pm ]
Post subject:  Re: Loading pdf file on Win Form

Hello Peter,

I really would have to see the error/call stack to know what error you're seeing.

In general, this library is all about creating PDF documents and isn't a rendering engine for PDF, so a Preview would require AcroReader or something similar. If you had a PDF Viewer control that you could use in winforms, then this would be the way to go.

-Jeff

Author:  peterposnag [ Wed Dec 15, 2010 2:17 pm ]
Post subject:  Re: Loading pdf file on Win Form

Hello Jeff,
Thank you for replying,
yes I have Adobe Acrobat installed in my PC,
but I always, get this error,
The referenced assembly "..\PDFsharp\code\PdfSharp.AcroPdfLib\bin\Release\PdfSharp.Viewing.dll" was not found. If this assembly is produced by another one of your projects, please make sure to build that project before building this one. PdfViewer.Demo.
I have try to use the PagePreview page1 = new PagePreview(); but I can load a pdf on it, here is my code example.
public partial class Form1 : Form
{

PagePreview page1 = new PagePreview();

PdfDocument form;
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

form = new PdfDocument();
PdfPage page = new PdfPage();
page1.Dock = DockStyle.Fill;
//page1.na
form.Pages.Add(page);

this.Controls.Add(page1);
form.Save("vvv1.pdf");


}

}
once again thank you.
Peter

Author:  peterposnag [ Wed Dec 15, 2010 6:01 pm ]
Post subject:  Re: Loading pdf file on Win Form

Hello everyone,
I already find a solution and I want expose it here for everyone that wants load a pdf file on a winform,
in this link is the pdfsharp.viewing class that I used.
http://www.koders.com/csharp/fid0DBADF0 ... s=zoom#L95,
enjoy it.
peter

Page 1 of 1 All times are UTC
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/