|
You can access OCG layers through the document dictionary (doc.Root property). However, you will have to dive deep into the PDF specification.
|
|
Hello, thanks for the example. However, my version does not yet know Patagames.Pdf.Net.OptionalContent, and the Document does not yet have a property OCProperties. How can I avoid that?
|
|
Hello, To solve this problem, three main steps are required. 1. Get Mouse coordinate in the control coordinate system and convert it to the page coordinate system using pdfViewer.ClientToPage method https://pdfium.patagames...er_CoordinateSystems.htm2. Enumerate all page objects and check the pageObject.BoundingBox property https://pdfium.patagames...ts.htm#enumerate-objects3. For each pageObject whose bounding rectangle surrounds a given point, find out its visibility group (Optional Content) and check if it is visible https://pdfium.patagames...gSDK_OptionalContent.htmCode:
var page = pdfViewer1.CurrentPage;
var pageObject = page.PageObjects[0];
var markedContent = pageObject.MarkedContent[0]; //The MarkedContent collection can contain multiple types of objects, so check them all, not just the first element as in this line.
var optionalcontent = markedContent as PdfOptionalContent; //You need an optional content only.
if(optionalcontent!= null)
{
var group = optionalcontent.Group;
if(group == null)
{
// optional content may be part of the membershop. In this case, the Group property is null
group = optionalcontent.Membership.OCGs[0]; //Collection OCGs may contain several groups. I think you need to check all of them, not just the first item as in the example.
}
bool isStateOn = pdfViewer1.Document.OCProperties.CheckVisibility(group);
}
|
|
Hello, how can I check whether the cursor is over a PathObject in a visible OCG when I mouse move in the PDF viewer?
In the next Step i want to delete or move the Line or change the Color.
I'm working with Patagames PDF version 4.10.10.35
Christian
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close