Pdf overlaying not working

走远了吗. 提交于 2019-12-06 04:49:20
mkl

White in a pdf can be a result of two fundamental situations: Either it is the result of nothing being drawn there or of something being drawn there using an effective color white. PDFs of the first type can be given a background using those page merge methods, PDFs of the latter can't.

The content stream of the page of your sample file a.pdf starts like this:

1 0 0 -1 0 841 cm
0.45 0 0 0.45 0 0 cm
1 0 0 1 0 0 cm
0 0 m 2646 0 l 2646 1870 l 0 1870 l h
q
1 1 1 rg f
Q

The first three lines change the coordinate system for the operations to come to have its origin in the upper left corner, coordinate values increasing right and down, and one unit being 1/160 inch.

The fourth line draws a rectangle covering the whole page (actually even slightly more) and the sixth line fills that rectangle with white. (The fifth and seventh line merely save and restore the graphics state.)

By overlaying this PDF over a page of another one, therefore, this PDF first of all covers all the existing content of that page with a white rectangle.

Thus, your PDF cannot be given a background by simply adding the page content to the content of a background PDF page. You have to

  • either remove the lines 4 and 6 from that content first (maybe there is some checkbox in lucidchart allowing you to switch this white background rectangle on or of)
  • or use a different watermarking procedure (like doing it the other way around, overlaying your PDF page with the watermark PDF page using transparency).

PS: Strictly speaking those content lines already are erroneous: As soon as you start constructing a path (which in the sample above happens with 0 0 m, i.e. a move to position 0, 0), you may only use path construction (or path clipping) operations until you finally use a path drawing operator (f, i.e. fill, in your sample). Cf. this answer for a reference.

Thus, the color setting 1 1 1 rg (i.e. set fill color to RGB 100%, 100%, 100%) and the special graphic state manipulation q (save graphic state) operations are not allowed here. Depending on the PDF viewer, therefore, different things may happen while displaying that page, e.g. the filling operation might be completely ignored or merely the color setting operation might be and the current fill color (black?) might be used instead. One cannot count on all PDF viewers handling this error like Adobe Reader does.

Maybe lucidchart have already fixed that issue and an update suffices. Otherwise you should ask lucidchart to start doing their PDF charts right.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!