簡體   English   中英

如何“加水印” PDF文件?

[英]How to 'watermark' a PDF file?

好的,我熟悉整個概念,並且已經設法對NSImage進行“水印”處理。

這就是我的做法:

- (void)maskOne:(NSString*)filename atTarget:(NSString*)folder
{
    NSString* target = [self getTargetPathForFile:filename path:folder];

    NSImage* newImage;

    NSImage* oldImage = [[NSImage alloc] initWithContentsOfFile:filename];

    newImage = [self maskImage:oldImage withMask:[self imageWithSubviews]];

    [self saveImage:newImage asPNG:target]; 
}

其中[self imageWithSubviews]從嵌入的black-bg框返回NSImage ,其中包含一些透明文本。


現在,在我的一個更大的應用程序,作為一個子項目,我想“保護”通過應用水印(沒有什么復雜的,只是在每個頁面的中間一段簡單的文字,或東西)導出PDF文件。

你會怎么做?

您可以使用CoreGraphics框架修改PDF內容-閱讀有關該主題的Apple官方文檔

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM