سؤال

هل من الممكن إزالة أو إخفاء طبقة من PDF باستخدام ABCPDF أو إطار آخر؟

لا يوجد حل صحيح

نصائح أخرى

يوضح المثال C # التالية كيف يمكن حذف طبقة 2 من الصفحة 1:

Doc theDoc = new Doc();
theDoc.Read("source.pdf");
int thePages = theDoc.GetInfoInt(theDoc.Root, "Pages");
int thePage = theDoc.GetInfoInt(thePages, "Page 1");
int theLayer = theDoc.GetInfoInt(thePage, "Content 2");
theDoc.Delete(theLayer);

أو ربما كنت تبحث عن تتسطح () وظيفة؟

يحتوي ABCPDF على مشروع مثال يسمى OCGLAYERS. يوضح لك هذا المشروع كيفية تحديد وإعادة حساب جميع العناصر في طبقة.

علي سبيل المثال:

        Properties props = Properties.FromDoc(_doc, false);
        Page page = (Page)_doc.ObjectSoup[_doc.Page];
        Reader reader = Reader.FromPage(props, page);
        List<OptionalContent.Layer> layers = reader.GetLayers();
        foreach (OptionalContent.Layer layer in layers) {
            if (layer.Visible == false) {
                if (reader == null)
                    reader = Reader.FromPage(props, page);
                Reader.Redact(ref reader, layer);
            }
        }
        UpdateLayers();
        UpdatePreview();
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top