Rank: Advanced Member
Groups: Guest
Joined: 10/12/2015(UTC) Posts: 44
|
While we are processing psd files there are situations when we need to provide an empty string for the text value. Code:psdProcessor.StringCallback = (processor, textFrame) => {
if(textFrame.Text == "PET NAME")
return GetPetNameFromDatabase();
return textFrame.Text;
};
For instance, we have one text layer that provides a Name, and another with their Pet Name. If they don't have a Pet Name I'm returning string.Empty, but that throws an ArgumentNullException. Code:Message: Value cannot be null. Parameter name: text
Aurigma.GraphicsMill.AdvancedDrawing.Graphics.DrawText(Text text):21
Aurigma.GraphicsMill.Templates.PsdProcessor.RenderText(PsdTextFrame frame):673
Aurigma.GraphicsMill.Templates.PsdProcessor.RenderFrame(PsdFrame frame):23
Aurigma.GraphicsMill.Templates.PsdProcessor.CreateContainer(PsdFrame frame):46
Aurigma.GraphicsMill.Templates.PsdProcessor.CreateContainer(Stream psdStream):103
Aurigma.GraphicsMill.Templates.PsdProcessor.Render(Stream psdStream, Stream outStream, WriterSettings writerSettings):42
How can we return an empty string or flag the layer to not be rendered? Unfortunately this is crucial to our processing/logic.
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 7/4/2017(UTC) Posts: 43
Was thanked: 12 time(s) in 12 post(s)
|
Hi, Try to return "\0" (which is the Unicode null character) value instead of string.Empty. Regards, Andrew Edited by user Tuesday, December 26, 2017 8:55:29 PM(UTC)
| Reason: Not specified
|
1 user thanked Andrey Semenov for this useful post.
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 10/12/2015(UTC) Posts: 44
|
That worked perfect. Thank you.
|
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.