You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2025/05/12 09:14:55 UTC

(xmlgraphics-website) branch master updated: Add layers example

This is an automated email from the ASF dual-hosted git repository.

ssteiner pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-website.git


The following commit(s) were added to refs/heads/master by this push:
     new 66f175b4 Add layers example
66f175b4 is described below

commit 66f175b4d17bcc180afcccda319999763fe755bd
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Mon May 12 10:14:41 2025 +0100

    Add layers example
---
 content/fop/trunk/metadata.mdtext | 43 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/content/fop/trunk/metadata.mdtext b/content/fop/trunk/metadata.mdtext
index d13cf597..fc895db7 100644
--- a/content/fop/trunk/metadata.mdtext
+++ b/content/fop/trunk/metadata.mdtext
@@ -202,4 +202,45 @@ Allows attaching custom XMP metadata to a specific PDF page object
         </x:xmpmeta>
       </pdf:page>
     </fo:simple-page-master>
-   
\ No newline at end of file
+   
+#PDF Layers
+
+Add a image as a layer, can be hidden using a layers button inside Adobe Reader
+
+## Usage (fo) { #fo}
+
+    :::xml
+    <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:fox="http://xmlgraphics.apache.org/fop/extensions" xmlns:pdf="http://xmlgraphics.apache.org/fop/extensions/pdf">
+      <fo:layout-master-set>
+        <fo:simple-page-master page-width="210mm" page-height="297mm" master-name="Page">
+          <fo:region-body region-name="Body"/>
+        </fo:simple-page-master>
+      </fo:layout-master-set>
+      <fo:declarations>
+        <pdf:layer id="watermark">
+          <pdf:string key="Name">watermark</pdf:string>
+        </pdf:layer>
+        <pdf:catalog>
+          <pdf:dictionary key="OCProperties">
+            <pdf:array key="OCGs">
+              <pdf:reference refid="watermark"/>
+            </pdf:array>
+            <pdf:dictionary key="D">
+              <pdf:array key="Order">
+                <pdf:reference refid="watermark"/>
+              </pdf:array>
+            </pdf:dictionary>
+          </pdf:dictionary>
+        </pdf:catalog>
+      </fo:declarations>
+      <fo:page-sequence master-reference="Page">
+        <fo:flow flow-name="Body">
+          <fo:block>Here is some text</fo:block>
+          <fo:block fox:layer="watermark">
+            <fo:block>
+              <fo:external-graphic src="image.png"/>
+            </fo:block>
+          </fo:block>
+        </fo:flow>
+      </fo:page-sequence>
+    </fo:root>
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org