Loading PdfViewer document dynamically

Hi,

I’m trying to load a PDF document dynamically at runtime. but with success.

I’m setting the UrlLink property in the event handler in the pages’ code behind but the document doesn’t render.

Is there a load method or similar that is needed in addition?

The file is valid because I can enter the full pathname in the control’s Url property and it renders OK.

Using FS-9.2.54

Hi Andyb,

You can do this by using both a tag for the PDF file path and the property pdfViewer.UrlLink

We have developed an example project demonstrating this.

Please find the project attached at the following link:

Best regards,
Gabriel Caetano.

Hi Gabriel_support.

I gave the example project a try and the only thing I was missing was a call to the Validate() method.

For the benefit of others, here’s the code behind:

TPdfViewerControl pdfViewer;

public void DisplayOpening()
{
pdfViewer = CurrentDisplay.GetControl(“pdf1”) as TPdfViewerControl;
pdfViewer.UrlLink = string.Empty;
}

public void DisplayIsOpen()
{
// Add your code here
}

public void DisplayClosing()
{
// Add your code here
}

public bool DialogOnOK()
{
// Add your code here

return true;

}

public void MouseLeftButtonDown1(object sender, System.Windows.Input.InputEventArgs e)
{
pdfViewer.UrlLink = “d:\temp\brc_dlyb.pdf”;
pdfViewer.Validate();
}