Hello,
I am trying to add a layer in a document, which is already loaded in a PdfDocumentView, but the UI is not upaded. I have to unlaod the document and then load it again. Is there anything I am missing that can be done in order to refresh the document without the need to reload it. Here is a snippet of the code I am using:
//glfullpath path to the loaded document
document = new PdfLoadedDocument(glfullpath);
var page = document.Pages[pageIndex-1];
PdfPageLayer layer = page.Layers.Cast<PdfPageLayer>().FirstOrDefault(x => x.Name == "test");
if (layer == null)
{
layer = page.Layers.Add("test", true);
}
layer.Graphics.SetTransparency(0.5f, 0.5f, PdfBlendMode.Multiply);
layer.Graphics.DrawRectangle(new PdfSolidBrush(new PdfColor(color.R, color.G, color.B)), rectangleF);
document.Save();
//LeftDocument is the
PdfDocumentView
LeftDocument.Unload(true);
LeftDocument.Load(glfullpath);
I also tried to add the layer directly to LeftDocument.LoadedDocument, but the result was the same.
Thanks in advance.
Looking forward for your reply.
Regards,
Stefan