- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Adding external images to report with JSL
I've found that I can copy/paste an image into a report/journal (https://www.jmp.com/support/help/14-2/paste-an-image-at-the-end-of-a-report.shtml#865792)
is there a way to do this in JSL? are there any options for placement/resizing? My ultimate goal is to automate the generation of reports add relevent images and then publish to HTML.
I had thought to publish the reports and then add the images to the HTML file, but the files generated by JMP are not easy to modify, the <body> sections are blank and I think must be generated dynamically when the page is loaded.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding external images to report with JSL
You can read in external images into a Picture Box(), and then place that into a Journal.
Names Default To Here( 1 );
pb = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) );
nw = New Window( "jj", <<journal );
nw << append( pb );
You can also adjust the size
Names Default To Here( 1 );
pb = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) );
pb << set width(800);
pb << set height(800);
nw = New Window( "jj", <<journal );
nw << append( pb );
In the construction of a Journal, you can organize it's contents using the various JSL functions and objects to do location, spacing, page breaks, etc.
See the Scripting Guide
Help==>Books==>Scripting Guide
and also the Scripting Index
Help==>Scripting Index
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding external images to report with JSL
You can read in external images into a Picture Box(), and then place that into a Journal.
Names Default To Here( 1 );
pb = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) );
nw = New Window( "jj", <<journal );
nw << append( pb );
You can also adjust the size
Names Default To Here( 1 );
pb = Picture Box( Open( "$SAMPLE_IMAGES/tile.jpg", jpg ) );
pb << set width(800);
pb << set height(800);
nw = New Window( "jj", <<journal );
nw << append( pb );
In the construction of a Journal, you can organize it's contents using the various JSL functions and objects to do location, spacing, page breaks, etc.
See the Scripting Guide
Help==>Books==>Scripting Guide
and also the Scripting Index
Help==>Scripting Index
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding external images to report with JSL
Hi Jim and All
Is there a way to embed the picture directly in the script? In multi user workplace, the path/picture can get deleted
This post originally written in German and has been translated for your convenience. When you reply, it will also be translated back to German.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding external images to report with JSL
Here is an example of an image being part of JSL in a script;
Names Default To Here( 1 );
textImage = New Image(
Char To Blob(
"1iVBORw0KGgoAAAANSUhEUgAAABgAAAAYCAYAAADgdz34AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJ
cEhZcwAADsMAAA7DAcdvqGQAAAEaSURBVEhL1ZTBDYMwDEW7E7N0BeboGqzALFzZJTfqF+WLyHUCEnDokyyIk/xvp6
SvlNL2ZGSDuzllsBDrHlP13hqLrgHCw2fZXsTbPQ9inNndMWC6KerzwVNdNA2ogMXDbC3bOxvYONg7c4zJM87rLKbVw
taP9uSoIDRQ9VoEUQ6yAfky9sQGJuKFFquKSpsGLi9CgwgEQgPLkW9x2oCzRYhzriFHBy1OG/DDRULZ4I4OxtKB57YO
EOK8PYjf0gFCfDGe3MFVA106jsnT6uDwJteoSm6uZ58rCYOC9DkfGuTvvFRZ/0uKeh5h/zF0DXS5cphIhARlQmAkzhn
Y5qh6IWGZ1HQNgLP1tzdC/6SeQ4Or/Bg8Gf9ukLYvWuoqiUvI3KwAAAAASUVORK5CYII=",
"base64compressed"
),
"png"
);
New Window( "Test", textImage );
Here is the code that I used to read in the image and create the JSL
Names Default To Here( 1 );
theImage = Open( "C:\Program Files\JMP\JMPPRO\18\Samples\Images\pi.gif" );
textImage = theImage << get picture;
Show( textImage );
Window( "pi.gif" ) << close window;
I just cut and pasted the results of the Show() from the log, to the script window.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: Adding external images to report with JSL
It is not possible to insert external photos directly into a report using JSL (JMP Scripting Language || Mulesoft Course). Photos, on the other hand, can be included by referencing them via URL.
// Create a new report
myReport = New Report("My Report");
// Add a Text Box
myText = Text Box("This is my report.");
// Add an Image Box and specify the URL of the image
myImage = Image Box("https://example.com/image.jpg");
// Add the Text Box and Image Box to the report
myReport << Add Text Box(myText);
myReport << Add Image Box(myImage);
// Display the report
myReport << Show Window;
When adding an image, replace "https://example.com/image.jpg" with the URL of the image. When run this script will create a report, with a text box showing the image from the given URL followed by an image box.