如何隐藏一层与Adobe的JavaScript层时添加PyPDF2 [英] how to hide one layer with adobe javascript when layers added with PyPDF2

查看:268
本文介绍了如何隐藏一层与Adobe的JavaScript层时添加PyPDF2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要在PDF添加两层PyPDF2。顶层是阻断整页的空白层。另外补充层为水印。

I want to add two layers in pdf with PyPDF2. The top layer is a blank layer which block the whole page. The other added layer is watermark.

在JavaScript的使用addJS(),我想隐藏顶层的一些条件,这意味着我要显示与水印原始的PDF,但不是顶层增加。但是,当我读的Adobe javascript中,我发现有两个问题:

In javascript added with addJS(), I want to hide the top layer with some condition, which means I want to show the original pdf with watermark, but not the top layer. But when i read adobe javascript, i found there were two problems:

1)我知道土坯JavaScript可以添加图层,并隐藏它,但我不知道如果我加了一层与PyPDF2,土坯JavaScript可以将其隐藏。

1) I know adobe javascript can add layer and hide it, but i'm not sure if I add a layer with PyPDF2, adobe javascript can hide it.

2)在Adobe的JavaScript,它可以隐藏层的名称。但是我加层PyPDF2,我没怎么看,我可以用的名字加了一层。

2) In adobe javascript, it can hide layer with name. But I add layer with PyPDF2, I didn't see how I can add a layer with name.

推荐答案

我想你混淆层和层。

图层你在说什么(事情可以显示并与Adobe的Javascript隐藏)的概念在技术上被称为可选内容。您也可以遇到的条款OCG(可选内容组),OCCD(可选内容配置词典)或OCMD(可选内容籍字典)。

The concept of layers you're talking about (the things you can show and hide with Adobe Javascript) are technically referred to as "Optional Content". You may also come across the terms OCG (Optional Content Group), OCCD (Optional Content Configuration Dictionary) or OCMD (Optional Content Membership Dictionary).

据我所看到PyPDF2不支持这一点。看看这个(仍然打开)车票例如: https://github.com/mstamy2/ PyPDF2 /问题/ 92

As far as I can see PyPDF2 doesn't support this. Have a look at this (still open) ticket for example: https://github.com/mstamy2/PyPDF2/issues/92.

所以,当PyPDF2谈到对PDF的顶部增加了一层(或叠加两种PDF文件在一起),他们只是在谈论采取一个PDF文件的内容,并在另一个PDF顶部添加。这将合并两个PDF文件的内容的对象,但不插入任何可选内容信息

So when PyPDF2 talks about adding a layer on top of a PDF (or layering two PDFs together), they are simply talking about taking the content of one PDF file and adding it on top of another PDF. This will merge the content objects of the two PDF files, but without inserting any Optional Content information.

因此​​各层你正在谈论与PyPDF2的类型不能打开或关闭与Adobe的Javascript,因为他们不是可选内容图层。

Hence the type of layers you are talking about with PyPDF2 cannot be turned on or off with Adobe Javascript because they are not "Optional Content" layers.

为了做你想要什么,你需要找到一个库或工具,可以对使用的可选内容系其他PDF上添加一个PDF文件。

In order to do what you want you need to find a library or tool that can add a PDF on top of another PDF using the Optional Content system.

这篇关于如何隐藏一层与Adobe的JavaScript层时添加PyPDF2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆