Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Dynamic images  (Read 16569 times)
David Z.
Posts: 19


« on: February 19, 2014, 09:41:18 pm »

GDC = 2.41.02
FGL = 2.41.02
GRD = 2.41.31
GRE = 2.41.17
RHEL 5.9

I have SVG files I want to print in a PDF. I put an Image Box on my page. I can set the Location property to a specific path/file.svg and the image will print. My problem is, I need to print a different SVG file on each page. I tried setting the location to a variable, and it accepts it as correct syntax, but I get the following errors when my 4gl hits the FINISH REPORT statement.

Exception at document location :
LoaderStyleSheet: element no 69 path=/Report
FGLReportToRTLInputStyleSheet: element no 69 path=/Report
ScopeExtenderStyleSheet: element no 68 path=/Report
RTLStyleSheet: element no 68 path=/Report
BoxDecoratorStyleSheet: element no 3 path=/PXML/MINIPAGE/IMAGEBOX
HlPxmlToPxmlStyleSheet: element no 4 path=/PXML/MINIPAGE/BORDERBOX/IMAGEBOX
PxmlLayouter: element no 4 path=/PXML/MINIPAGE/BORDERBOX/IMAGEBOX
PdfWriterStyleSheet: element no 1 path=/DVI
Processor error:
com.fourjs.pxml.shared.AttributeException: java.net.URISyntaxException Illegal character in path at index 19: tmp/sketch1234.html
The error continues with many lines starting with:
at com.fourjs.pxml........

Also, in the document errors in the GRD, I get this error....
Failed to read image from url "foobar". Reason="Error opening /dw/grw/foobar: No such file or directory".
...I agree. I don't have a file named /dw/grw/foobar. I keep my 4rp and rdd files in /dw/grw.

Can I print a dynamic SVG/image in a PDF?

Thanks,
David
Alex G.
Four Js
Posts: 155


« Reply #1 on: February 19, 2014, 10:11:08 pm »

Hi,
>Can I print a dynamic SVG/image in a PDF?
Sure. You can specify a URL based on one or more variables using an RTL expression. This is demonstrated in the "OrderReport.4rp" where the "ImageBox2" element has the expression "./images/database/"+orderline.product.prodpic.trim()" .
>...I agree. I don't have a file named /dw/grw/foobar. I keep my 4rp and rdd files in /dw/grw
I am guessing that you have an expression similar to something like "/dw/grw/+imageName.
The default sample data for the string variable "imageName" is "foobar" so that you are getting the error. Go to the data view window and change the sample data value for this variable to an existing image name (e.g. "mylogo.svg") and the error message will go away the the image will be displayed in the design window.
>but I get the following errors when my 4gl hits the FINISH REPORT statement.
I suspect that you may be missing a ".trim()" in the expression (This is needed if the variable has a fixed length (not STRING)). I suggest that you get in contact with support if you can't spot the issue.
Regards,
Alex
David Z.
Posts: 19


« Reply #2 on: February 19, 2014, 10:50:34 pm »

I tried support, but I was not getting useful replies. I think you gave me the hint that I needed to get it to work. I may have been confused by the term URL. I thought a URL was for a browser. Such as http:..... You seem to be using the term for a regular path also. The documentation seems to imply location is a file name. From the docs:

Use the Location property to specify the file name and path of the image to be rendered. Press the ... button to open a dialog and select the image located in your file structure.

I don't see anything about using a variable name.

David

Alex G.
Four Js
Posts: 155


« Reply #3 on: February 20, 2014, 08:52:41 am »

Hi,
>I don't see anything about using a variable name.
Variables (RTL expressions) can be used for any property so that this is not specifically repeated for the "Location" property.
Nevertheless the documentation of the ImageBox element (https://4js.com/online_documentation/fjs-grd-manual-html/c_grd_layoutelements_imagebox.html) has several paragraphs on the topic.
It also explains that images can be stored in the database and an example is given on how the value of a 4GL BLOB variable can be used to display an image.
>I thought a URL was for a browser. Such as http:..... You seem to be using the term for a regular path also.
Yes, it is a URL supporting the protocols "http", "file" and "data". I will see that we make this more clear in the documentation.
Regards,
Alex 
Scott B.
Four Js
Posts: 27


« Reply #4 on: February 21, 2014, 07:16:26 pm »

Thank you for this detail. The documentation has been updated for the next release.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines