开发者

how to watermark a rendered PDF (on context) without repeating the image

I'm rendering a PDF file on my iPad using a graphics PDF context. The PDFs vary in size but may be up to 90 pages. I need a background image on each page but if I simply draw it the PDF file size will be way larger. Is there a way to kinda only add it 开发者_StackOverflow社区once and 'share' it somehow across pages?

Thanks


The PDF format specification enables you to re-use objects "by reference". You can re-use any object multiple times that is defined only once. Usually that happens with fonts, logos, background images, watermarks, ICC profiles, ....


I did a test where I repeated a background image behind each PDF page. Surprisingly, the file size increased by a single and constant amount, regardless of the number of pages with repeated backgrounds.

The verdict: The drawing to PDF context libraries are smarter than you might think.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜