Watermark applied on the pdf is not visible in the FreeBSD

In freeBSD, watwermark is applied on the pdf but it is not visible on the file. Tried Helvetica, Courier, NewsGoth BT Bold. It was worked in windows but facing issue in the freeBSD. What could be the reason ? Can anybody help to debug or find the solution for this issue. I have attached the file which was watermark applied pdf file. Applied watermark text is “Confidential”
test-card-6.pdf (109.0 KB)

.

@Lakshmics

Please share following details and we’ll investigate this scenario:

  • Watermark code
  • Output files/PDF
  • Watermark API version that you are using
  • FreeBSD and JRE/JDK versions

@atir.tahir

  1. Below is the watermark code
package com.sample.test;

import java.awt.Color;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;

import com.groupdocs.watermark.Watermarker;
import com.groupdocs.watermark.common.FileType;
import com.groupdocs.watermark.common.HorizontalAlignment;
import com.groupdocs.watermark.common.VerticalAlignment;
import com.groupdocs.watermark.options.PresentationWatermarkSlideOptions;
import com.groupdocs.watermark.options.WatermarkOptions;
import com.groupdocs.watermark.options.WordProcessingLockType;
import com.groupdocs.watermark.options.WordProcessingWatermarkPagesOptions;
import com.groupdocs.watermark.watermarks.Font;
import com.groupdocs.watermark.watermarks.FontStyle;
import com.groupdocs.watermark.watermarks.TextAlignment;
import com.groupdocs.watermark.watermarks.TextWatermark;

public class WatermarkTest {

    public static void main(String[] args) throws IOException {
    	WatermarkTest w = new WatermarkTest();
    	w.maskUnstructured();
    }

   
    public void maskUnstructured() throws IOException {
    	try (InputStream source = getClass().getResourceAsStream("/test-card-6.pdf");
                ByteArrayOutputStream target = new ByteArrayOutputStream()) {
            	try (Watermarker w = new Watermarker(source); target) {
                    WatermarkOptions extraOps = toWatermarkOptions(w);
                    TextWatermark tw = new TextWatermark("Confidential", new Font("Courier", 90F, FontStyle.Regular));
                    tw.setTextAlignment(TextAlignment.Left);
                    tw.setOpacity(0.5);
                    Color c = Color.decode("#FF0000");
                    tw.setForegroundColor(com.groupdocs.watermark.watermarks.Color.fromArgb(c.getAlpha(),
                            c.getRed(), c.getGreen(), c.getBlue()));
                    tw.setHorizontalAlignment(HorizontalAlignment.Center);
                    tw.setVerticalAlignment(VerticalAlignment.Center);
                    tw.setRotateAngle(45);
                    if (null == extraOps) {
                    	w.add(tw);
                    } else {
                    	w.add(tw, extraOps);
                    }
                    w.save(target);
                }
            	Files.write(Paths.get("watermarked.pdf"), target.toByteArray());
    	}
    }

    private WatermarkOptions toWatermarkOptions(Watermarker w) {
        FileType fileType = w.getDocumentInfo().getFileType();
        if (FileType.DOC.equals(fileType) || FileType.DOCX.equals(fileType)) {
            WordProcessingWatermarkPagesOptions options = new WordProcessingWatermarkPagesOptions();
            options.setLocked(true);
            options.setLockType(WordProcessingLockType.ReadOnlyWithEditableContent);
            return options;
        } else if (FileType.PPT.equals(fileType) || FileType.PPTX.equals(fileType)) {
            PresentationWatermarkSlideOptions options = new PresentationWatermarkSlideOptions();
            options.setLocked(true);
            options.setProtectWithUnreadableCharacters(true);
            return options;
        }
        return null;
    }
}
  1. Watermark API version 20.5

  2. FreeBSD 14.0-RELEASE-p5 and JDK version is 17

@Lakshmics
This issue is under investigation. We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): WATERMARKJAVA-133

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.
We’ll let you know if any further details are required.