cancel
Showing results for 
Search instead for 
Did you mean: 

line break in an SVG object

Former Member
0 Kudos

Hi friends,

I am using an SVG object to create a pdf from BLS.I am assigning a string value to a variable pre-defined in that SVG object.The problem here is i am unable to get carriage return in that string(string is of huge length) which is being displayed on the PDF.It is getting out of the PDF created.I had used 'crlf' but it is not working.Any suggestions on this would be really appreciated.

regards,

Ravi Kumar

Message was edited by:

Ravi Kumar

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I don't understand what you are doing. Are you creating a PDF document from Business Logic and in the PDF document there is an SVG object?

Former Member
0 Kudos

Hi,

I had created an SVG object.I had created another animated object and mapped the variables created in animated object to variables in svg object.This animated object i had mapped to PDF as encoded image.The image is getting displayed and the strings assigned to variables are also getting displayed,but i am not getting carriage return if the string is of large length.it's getting out of the page.

regards,

ravi kumar

jcgood25
Active Contributor
0 Kudos

So it sounds like you have something like a Title on the image and because it has too many characters to fit within the width of the image it is falling off the edges of the image?

If this is going to happen frequently with the string being fed into the image then maybe you should split the object into two rows and use the string functions in the expression editor to get the left and right portions and link the trimmed string portions into the two rows.

Regards,

Jeremy Good

Former Member
0 Kudos

Hi Jeremy,

You intrepeted my problem correctly.But here i need to print pallet numbers associated for a delivery item on a ticket.Sometimes i may be getting 1 or 2 lines of pallet numbers for a delivery item and sometimes i may get 5 or above lines.You had mentioned to leave two rows in hand before assigning the string.This needs to be generic in my case because the no. of lines will vary and also i need to cater the space left for other delivery items to be shown on the ticket.I had used 'crlf','\n','\r','
' wild characters but it's not giving the line-break which i am in search for.

regards,

Ravi Kumar

Former Member
0 Kudos

Hi, Ravi.

One of the cool things about SVG is that it is nothing more than an XML document! So, you have two options to achieve what you would like to do:

Solution 1 involves using the animation editor's expression capabilities to meet your needs:

1a) If you can assume a "maximum" number of lines (let's assume 8 line items maximum), you can place all 8 text objects in their correct position on the SVG object (and name the SVG element ID's something like TextLine1,TextLine2, etc.). In the animation editor, provide 8 input properties (of type String) corresponding to these text values. In fact, let's call them TextLine1,TextLine2...TextLine8.

1b) In the animation editor, link the these properties to the corresponding text property for each of your 8 SVG elements.

1c) Now, here's the magic part: link the following expression (adjusted for each text line item) to the "visibility" attribute of each of your 8 SVG elements.

stringif(stringlength(TextLine1) > 0,"visible","hidden")

1d) Then, in your BLS transaction you'll need to split your list of barcode items and loop through them or assign them. I'm not sure what your query is returning, but I'm sure there's a way, either with the functions or the web scraper (a RegEx parser) to do what you need. Let us know more specifics, and we can provide some guidance.

There's one other approach that takes advantage of the fact that an SVG document is nothing more than a special type of XML document. In this case, instead of "pre-adding" a fixed number of items, you'll simply use the "append XML" link type and a local property of type XML, which will contain your SVG text element, to dynamically add any number of items.

The key with these approach is to dynamically calculate the x and y positions for each text item (usually based on some fixed height), assign these attributes as well as the text content to a Local property, then append this to the SVG.

You have a few choices for how to load the SVG. One option is the XML Loader. However, you can mix the capabilities of the AnimatedObject + direct SVG manipulation as well.

Option 2a is to use the XML loader, manipulate the XML with assignment actions, then use the SVG renderer to convert it to an image.

Option 2b is to use the AnimatedObject action, which outputs both XML and an (optional) image - you should turn off "Render Image" in this case. You can then manipulate the SVG output to add your text items, and send this to an SVG renderer to convert it to an image.

The advantage of approach 2b is that you can use the standard functionality of the AnimationObject to make the easy stuff, and extend it with SVG manipulation for your "super dynamic" stuff.

Hope this helps,

Rick

R

Former Member
0 Kudos

Hi Rick,

I had done using your 1a suggestion and it had worked.

Thanks for ur remaining suggestions too...

regards,

ravi kumar

Answers (0)