logo
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Post a reply
From:
Message:

Maximum number of characters in each post is: 32767
Bold Italic Underline   Highlight Quote Choose Language for Syntax Highlighting Insert Image Insert an existing Attachment or upload a new File... Create Link   Unordered List Ordered List   Left Justify Center Justify Right Justify   Outdent Indent   More BBCode Tags
Font Color Font Size
Security Image:
Enter The Letters From The Security Image:
  Preview Post Cancel

Last 10 Posts (In reverse order)
Paul Rayman Posted: Friday, December 8, 2023 3:19:39 AM(UTC)
 
You can access OCG layers through the document dictionary (doc.Root property). However, you will have to dive deep into the PDF specification.
Bazi101 Posted: Friday, December 1, 2023 3:04:34 AM(UTC)
 
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?
Paul Rayman Posted: Thursday, November 30, 2023 10:30:43 PM(UTC)
 
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.htm

2. Enumerate all page objects and check the pageObject.BoundingBox property
https://pdfium.patagames...ts.htm#enumerate-objects

3. 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.htm

Code:

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);
}
Bazi101 Posted: Sunday, November 26, 2023 8:27:26 AM(UTC)
 
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