Free Support Forum - aspose.com

Zapf and Symbol fonts does not work in watermarks for pdfa

During adding watermark (TextStamp) to pdfa file we’ve found that Symbol and ZapfDingbats values of FontStyle enum does not work correctly.

They work fine when adding them to pdf file.

Please find attached input document and different result files.
input file - watermarks.pdf (17.3 KB)
correct result - pdf_symbol.pdf (19.2 KB)
correct result - pdf_timesroman.pdf (19.2 KB)
correct result - pdf_zapf.pdf (19.2 KB)
wrong result - pdfa_symbol.pdf (23.8 KB)
wrong result - pdfa_zapf.pdf (23.7 KB)
correct result - pdfa_timesroman.pdf (31.5 KB)

PS. For pdfa watermarks we convert input pdf to pdf/a and then add TextStamp

@uaprogrammer,

Kindly send us the code snippets which you are using to create these output PDF documents. Your response is awaited.

Hi,

Code for all sample files (correct and wrong) are the same:

var outputFormat = "pdfa";
//var outputFormat = "pdf";

Aspose.Pdf.Document pdfDocument = new Aspose.Pdf.Document(filePath);

TextStamp textStamp = InitializeTextStamp();

foreach (Page page in pdfDocument.Pages)
        {
            page.AddStamp(textStamp);
        }

if (outputFormat.Equals("pdfa"))
        {
            pdfDocument.Convert(new MemoryStream(), PdfFormat.PDF_A_1B, ConvertErrorAction.Delete);
        }

        pdfDocument.Save(filePath);

private TextStamp InitializeTextStamp()
    {
        var fontStyle = Aspose.Pdf.Facades.FontStyle.TimesRoman;
        Enum.TryParse("ZapfDingbats", out fontStyle);
        //Enum.TryParse("Symbol", out fontStyle);

        var textStamp = new TextStamp(new Aspose.Pdf.Facades.FormattedText("Test text stamp",
            System.Drawing.ColorTranslator.FromHtml("#FF88FD"),
            fontStyle,
            Aspose.Pdf.Facades.EncodingType.Winansi,
            true,
            14));

        textStamp.BottomMargin = 10;
        textStamp.RightMargin = 10;
        textStamp.TopMargin = 10;
        textStamp.LeftMargin = 10;
        textStamp.Opacity = 0.5;
        textStamp.RotateAngle = 0;
        textStamp.HorizontalAlignment = HorizontalAlignment.Left;
        textStamp.VerticalAlignment = VerticalAlignment.Top;
        textStamp.Background = false;

        return textStamp;
    }

@uaprogrammer,

We managed to replicate the problem of incorrect text rendering in our environment. We have logged tickets as follows:

PDFNET-44584: Output PDF/A_1B - incorrect rendering of the text style ZapfDingbats
PDFNET-44585: Output PDF/A_1B - incorrect rendering of the text style symbol

We have linked your post to these tickets and will keep you informed regarding any available updates.

Thank you.

We’ve found another test case with an issue with these 2 fonts. Just change horizontal position to the right in the same code

textStamp.HorizontalAlignment = HorizontalAlignment.Right;

and correct placement in pdf becames broken - text is out of page (but rendering is correct as it is pdf).

wrong result - pdf_zapf_right.pdf (19.2 KB)
wrong result - pdf_symbol_right.pdf (19.2 KB)
correct result - pdf_timesroman_right.pdf (19.2 KB)

@uaprogrammer,

Thank you for the details. We have logged tickets in our bug tracking system as follows:

PDFNET-44592: Output PDF - the text with style ZapfDingbats is being cut off
PDFNET-44593: Output PDF - the text with style symbol is being cut off

We have linked your post to these tickets and will keep you informed regarding any available updates.

Hi,

Would you be so kind to provide us with status on the PDFNET-44592 and 44593 issues?

Best regards,

Oleh

@uaprogrammer

We are afraid that earlier logged issues are not yet resolved due to other high priority implementations and tasks in the queue. We will let you know as soon as there is some updates regarding its rectification. Please spare us some time.

We are sorry for the inconvenience.