Hi!
I currently use just one front page for seven different PDF targets, using variables for the different name, manual types (user, administrator etc), doc numbers, etc. But now I need to add a bar code which is a gif image, and each manual has its own image. So I thought, add an image as a variable!
I have been experimenting with a new variable called BarCode and adding paths to the images as the seven definitions for this variable. But I cannot to get it to work. I really don’t know precisely how to point to the image. Is this even possible?
Right now, the only way I can think to do this is to have a front page per manual because I do know how to add an image in a page layout. But if I could add the gif as a variable, I could get away with still having just one front page. Maybe I could add all seven gifs to the same page layout and use conditions, but I already have so many conditions that I don’t know if I can wrap my brain around that.
Maybe it is just easier to create seven different front pages… Any ideas?
Thanks!
Images as variable in page layout?
Re: Images as variable in page layout?
You can do this with variables, just note that you won't see any images rendered at all in the PageLayout until you build the output.
Just use something like this:
Then create a VariableSet called Barcodes with a variable BarcodeType set to the filename of the barcode you want to use in that build. You can change any of this to suit your specific needs but the key is to express the variable as [%=VariableSet.VariableName%]
Just use something like this:
Code: Select all
<img src="../path/to/barcodes/[%=Barcodes.BarcodeType%]">Re: Images as variable in page layout?
Thank you much, but I don't think I fully understood, as it did not work...
The 'barcodes' in the path you suggest, that should be the folder where the images are, so something like ../path/to/images/
And your whole line is what I enter in the frame in the page layout?
And the variable set definition only has the file name itself, not any path?
I get the PDF when I generate, but there is no image
The 'barcodes' in the path you suggest, that should be the folder where the images are, so something like ../path/to/images/
And your whole line is what I enter in the frame in the page layout?
And the variable set definition only has the file name itself, not any path?
I get the PDF when I generate, but there is no image
Re: Images as variable in page layout?
Ah apologies, I thought perhaps that you were a bit further ahead in editing PageLayouts.
Change this to something like:
Then save the PageLayout again and close it.
This assumes that you have your PageLayouts in a folder inside the Resources folder and you have your barcodes inside a Barcodes folder inside your Images folder which is directly inside your Resources folder.
The ../ notation means "come up one directory", so you're telling flare to go from Resources/PageLayouts/ (where the PageLayout file is) to Resources/, and then to follow the rest of the file path i.e. Images/Barcodes/. You then use the Variable set as described previously to substitute the Barcode filename so set the variable as Barcode_1.gif (for example) in the target.
- Add a Decoration Frame to your PageLayout, and click it, press F2 and click No.
- You'll then see a window open up to edit the Frame contents with a paragraph block in by default.
- Type something unique in this paragraph block such as "barcode goes here"
- Save the PageLayout and then edit it in the text editor.
- Search for the phrase you entered above and you'll see the P tag in the XML structure of the PageLayout:
Code: Select all
<xhtml:p>barcode goes here</xhtml:p>
Code: Select all
<xhtml:p>
<xhtml:img xhtml:src="../Images/Barcodes/[%=Barcodes.BarcodeType%]" xmlns:MadCap="http://www.madcapsoftware.com/Schemas/MadCap.xsd" />
</xhtml:p>
This assumes that you have your PageLayouts in a folder inside the Resources folder and you have your barcodes inside a Barcodes folder inside your Images folder which is directly inside your Resources folder.
The ../ notation means "come up one directory", so you're telling flare to go from Resources/PageLayouts/ (where the PageLayout file is) to Resources/, and then to follow the rest of the file path i.e. Images/Barcodes/. You then use the Variable set as described previously to substitute the Barcode filename so set the variable as Barcode_1.gif (for example) in the target.