arklumpus / MuPDFCore

Multiplatform .NET bindings for MuPDF
GNU Affero General Public License v3.0
115 stars 20 forks source link

Block/Layer name #36

Open som3on3 opened 4 months ago

som3on3 commented 4 months ago
using var ctx = new MuPDFContext();
using var document = new MuPDFDocument(ctx, "source.pdf");

var page = document.GetStructuredTextPage(0);
foreach (var block in page) {
    // how to get layer name??
}

How to get the layer name from block?

arklumpus commented 4 months ago

Hi! I think you are referring to optional content groups (sometimes also known as layers), right? I.e., bits of content that can be toggled on and off in the PDF viewer interface. If this is the case, these are not currently supported by this library, but I can work on it as soon as I have a bit of time.

The structured text blocks you get from the structured text page are completely unrelated to this. Also note that the MuPDFStructuredTextPage class implements IDisposable, therefore you should also make sure that it is Disposed - e.g., with using var page = document.GetStructuredTextPage(0);

I will leave this issue open until I manage to look at implementing optional content groups!