изображение
Я поставил значение следующим образом:
Код: Выделить всё
var font = PdfFontFactory.CreateFont("C:\\Windows\\Fonts\\GOST Common.ttf", "Identity-H");
_workingDocument.SetFont(font);
string utf8String = count + "шт.";
var writableText = new Paragraph(utf8String).SetItalic().SetBold();
switch (_format)
{
case Formats.A4Book:
x = 530;
y = 175;
ClearText(text, x, y); //I'm trying to delete a value usingPdfCleaner.AutoSweepCleanUp
AddImage(x, y); //I present a picture that overlaps a part of another text that is not cleared and should not be in the ClearText method
writableText.SetFontSize(20).SetFixedPosition(x - 300, y, 350).SetTextAlignment(TextAlignment.RIGHT)
.SetHorizontalAlignment(HorizontalAlignment.RIGHT);
_workingDocument.Add(writableText);
break;
case Formats.A3Album:
... // The same thing, but the other x and y
case Formats.A3Book:
... // The same thing, but the other x and y
default:
...
}
Код: Выделить всё
int countTry = 0;
ICleanupStrategy cleanupStrategy =
new RegexBasedCleanupStrategy(new Regex(@"(.*)[0-9]{1,}(.*)шт(.*)", RegexOptions.IgnoreCase))
.SetRedactionColor(ColorConstants.WHITE);
while (countTry < 3)
{
try
{
PdfCleaner.AutoSweepCleanUp(_document.GetFirstPage(), cleanupStrategy);
}
catch
{
// ignore
}
finally
{
countTry++;
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... -paragraph