Ana içeriğe geç

Filigran Ekle Word

PDF4me Filigran Ekle Word bir REST Her sayfanın metninin arkasına resim filigranı ekleyen uç nokta Word belge. POST .docx dosyasını ve filigran görüntüsünü şu şekilde gönderin: Base64 ile office/ApiV2Word/AddWatermarkÖlçeği, şeffaflığı ve hizalamayı ayarlayın, ardından filigranlı dosyayı çözün. JSON cevap. PNG, JPG, JPEGBMP ve GIF formatındaki resimler desteklenmektedir.

Bu uç noktanın işlevi

Bir süre alır Word Belgeye bir resim ekler ve her bölümün metninin arkasına o resmi damgalayarak aynı belgeyi geri gönderir: bir logo, bir "GİZLİ" başlığı, bir "TASLAK" damgası. Boyutu (tam noktalar veya bir ölçek faktörü), %50 şeffaflık seçeneğini ve orta veya sol üst köşeye yerleştirmeyi siz kontrol edersiniz. Yanıt şöyledir: JSON sonuç olarak Base64 içerik.

İlgili Blog Yazıları
Bu özellik için henüz bir blog yazısı yok — yakında yayınlanacak.
Bu arada, her platforma yönelik eğitimler ve iş akışları için PDF4me bloguna göz atın.
Blogu ziyaret edin

Kimliğinizi Doğrulama API Rica etmek

Her PDF4me REST Çağrınızda mutlaka sizin de bulunmanız gerekiyor. API anahtara girin Authorization Başlıkta Temel kimlik doğrulama (Basic auth) belirtilmiştir. Anahtarınızı geliştirici kontrol panelinden alın veya değiştirin.

Uç nokta

POSTofis/ApiV2Word/Filigran Ekle

Kaçırmamanız Gereken Önemli Bilgiler

Yanıt şudur: Base64 JSONdosya değil
Filigranlı belge şu şekilde geri geliyor: Base64 içindeki bir dize JSON vücut ile fileName, success, Ve hataMesajıKaydetmeden önce kodunu çözün; ham yanıt geçerli bir .docx dosyası değildir.
Genişlik ve yükseklik ölçeği geçersiz kılar
Ölçü önceliği kesindir. Genişlik/yükseklik Önce puanlar halinde, sonra ölçekO halde orijinal resim boyutu. Sadece bir boyut gönderilir, diğer boyut en boy oranını koruyacak şekilde hesaplanır.
Metnin arkasında, her bölümde
Görüntü, belgenin tüm bölümlerinde ve başlıklarında içeriğin arkasına yerleştirilir, böylece metin okunabilir kalır. Şeffaf bir PNG artı Yarı saydam: doğru Klasik, zarif bir damga görünümü verir.

HTTP kurmak

Yöntem: POST
URL: https://api.pdf4me.com/office/ApiV2Word/AddWatermark
İçerik Türü: uygulama/json
Authorization: Temel <sizin PDF4me API anahtar>

Yanıt şudur: JSON: kontrol edin success bayrak, sonra Base64-Dönen belgenin içeriğini çözümleyin ve bir dosya ile kaydedin. .docx eklenti.

Filigran boyutlandırma önceliği nasıl çalışır?

Üç farklı boyutlandırma girdisi mevcuttur ve bunlar kesin bir şekilde sıralanmıştır. API Gönderdiğiniz en yüksek öncelikli girdiyi kullanır ve geri kalanını yok sayar.

Girdi ve davranış boyutlandırmasıUygulandığı zamanFiligranın elde ettiği şey
width Ve height (puanlar)En yüksek öncelik; geçersiz kılma scale mevcut olduğundaTam olarak belirttiğiniz boyutlarda. Tek bir boyut bile en boy oranını korur.
scale (0,1 ila 10,0)Yalnızca genişlik veya yükseklik gönderilmediğinde kullanılır.Orijinal resim boyutu şu faktörlerle çarpılır: 0,5 yarı boyut, 2,0 iki katı boyut.
İkisi de göndermedi.Geri çekilmekYüklenen görüntünün orijinal piksel boyutları

API vücut alanları

ParametreGerekliTipNe işe yarar?Örnek
documentRequiredobjectDocument reference carrying Name, the Word filename with its .docx extension.{ "Name": "document.docx" }
docContentRequiredstringBase64-encoded bytes of the Word document to watermark.UEsDBBQABgAIAAAA...
watermarkFileNameRequiredstringWatermark image filename with its extension. PNG, JPG, JPEG, BMP, and GIF are supported.watermark.png
watermarkFileContentRequiredstringBase64-encoded bytes of the watermark image. A PNG with a transparent background gives the cleanest behind-text result.iVBORw0KGgo...
scaleOptionalnumberScale factor from 0.1 to 10.0 applied to the original image size. Default 1.0. Ignored when width or height is sent.1.5
semiTransparentOptionalbooleantrue renders the watermark at 50 percent opacity for a subtle stamp; false (default) keeps full opacity.true
widthOptionalnumberExact watermark width in points. Overrides scale. If height is omitted it is calculated to keep the aspect ratio.200
heightOptionalnumberExact watermark height in points. Overrides scale. If width is omitted it is calculated to keep the aspect ratio.150
alignImageOptionalbooleantrue (default) centers the watermark on the page; false aligns it top-left within the margins.true
cultureNameOptionalstringCulture code applied to document metadata during processing, for example en-US or de-DE.en-US

Örnek yükler

Minimum istek (yalnızca gerekli alanlar)

{
"document": { "Name": "document.docx" },
"docContent": "UEsDBBQABgAIAAAA...",
"watermarkFileName": "watermark.png",
"watermarkFileContent": "iVBORw0KGgoAAAANSUhEUgAA..."
}

Boyutlandırılmış, yarı saydam, ortalanmış

{
"document": { "Name": "contract-draft.docx" },
"docContent": "UEsDBBQABgAIAAAA...",
"watermarkFileName": "confidential.png",
"watermarkFileContent": "iVBORw0KGgoAAAANSUhEUgAA...",
"width": 200,
"height": 150,
"semiTransparent": true,
"alignImage": true,
"cultureName": "en-US"
}

Postacı tahsilat ipuçları

Headers
Content-Type: application/json + Authorization: Basic <apiKey>.
Body
raw JSON with TWO Base64 fields: docContent for the Word file and watermarkFileContent for the image. Both must be encoded separately.
Sizing
Send width/height OR scale, not both. If you send both, the exact dimensions win and scale is silently ignored.
Response
JSON with a success flag and Base64 document content. Decode the document field before saving as .docx.

curl örneği

curl -X POST https://api.pdf4me.com/office/ApiV2Word/AddWatermark \
-H "Content-Type: application/json" \
-H "Authorization: Basic YOUR_API_KEY" \
-d '{
"document": { "Name": "document.docx" },
"docContent": "'"$(base64 -w 0 document.docx)"'",
"watermarkFileName": "watermark.png",
"watermarkFileContent": "'"$(base64 -w 0 watermark.png)"'",
"semiTransparent": true
}' \
--output response.json

Ne anlama geliyor? API geri dönmek?

A JSON Filigranlı belgeyi taşıyan sonuç Base64.

AlanTipİçeriğinde neler var?
documentString (Base64)The watermarked Word document content. Decode to bytes and save with a .docx extension.
fileNameStringOutput filename for the watermarked document.
successBooleantrue when watermarking succeeded. Check this before decoding content.
errorMessageStringPopulated when success is false: invalid Base64, a corrupted document or image, or out-of-range sizing values.

Asenkron davranış (202) Accepted anketle URL içinde Location Başlık (header) istek gövdesi parametresiyle değil, sunucu yapılandırmasıyla kontrol edilir. 202 geldiğinde, sunucuyu sorgulayın. Location URL ile GET 200 talep alana kadar OK aynı şekilde JSON şekil.

Kod örnekleri

Word Ofis uç noktaları henüz örnek deposundaki uç nokta bazlı örnek klasörlerinde yer almıyor; her birinin kullandığı istek modelini içeriyor. PDF4me uç nokta ailesi:

SSS

Which image formats can I use as a Word watermark?+
PNG, JPG, JPEG, BMP, and GIF. A PNG with a transparent background gives the cleanest result because the image is stamped behind the document text on every page.
Is the response the Word file itself?+
No. The API returns JSON containing the watermarked document as a Base64 string plus fileName, success, and errorMessage fields. Decode the document field to bytes before saving as .docx.
What happens if I send both scale and width or height?+
Width and height win. Exact dimensions in points always override the scale factor. If you provide only one of the two, the other is calculated automatically to preserve the image aspect ratio.
Does the watermark cover the document text?+
No. The watermark is placed behind the text, in every section of the document, so the content stays readable. Set semiTransparent to true for a subtle 50 percent opacity effect.
Can this endpoint add text watermarks like DRAFT or CONFIDENTIAL?+
This endpoint stamps images. For text stamps use the Add Text Watermark to Word endpoint, or render your text as a transparent PNG and pass it here as the watermark image.
Where does the watermark appear in the document?+
Across all sections and their headers, behind the content. alignImage true centers it on the page; false places it top-left within the margins. Per-page or per-range placement is not part of this action.
Does adding a watermark protect the document from editing?+
No. A watermark is a visual marker, not a security control; anyone who can edit the file can remove it. To restrict editing or require a password, chain the Secure Word Document endpoint after this one.

Filigran eklemenin nedenleri: API manuel olarak yerine Word?

Manuel rota resme filigran eklemek Word: Her dosyayı açın, Tasarım sekmesine gidin, Filigran'ı seçin, Özel Filigran'ı seçin, resmi seçin, kaydedin, tekrarlayın. Bu, her giden taslağa filigran ekleyen bir sözleşme sürecine uygun değildir. API Dosya başına tek bir belirleyici istek olarak aynı metin arkası damgasını uygular ve tam nokta boyutlandırmasını sağlar. Word Diyalog açık bırakılmıyor. Sonuç standart. dijital filigranlama Menşei ve durum işaretlemesi için, işlem hattı hızında uygulanır.

İlgili işlemler

Diğer platformlarda aynı görev

Yardım Alın