2 years ago

#60547

test-img

Greg

"\\" in strings, passing string is only returning characters before first back slash

I'm trying to delete layers in a pdf using itextsharp. I have the method to delete a layer, however I only want to delete certain layers by name. The names have "\" in them ("þÿ\0E\0N"), I'm not getting the expected string.

Dictionary<string, PdfLayer> layers = stamp.GetPdfLayers();

foreach (KeyValuePair<string, PdfLayer> layer in layers)
{
    string layername = layer.Key.ToString();
}

but layername is coming out just as "þÿ" I don't know why it's ditching the rest of the string after the first "\".

c#

string

itext

0 Answers

Your Answer

Accepted video resources