|
#1
|
|||
|
|||
|
Hi,
I need help with following task: there is graphic frame, where customer can select image from drop-down menu (it's not a rule creating graphics resource, simple drop-down menu with images names) or leave it blank. When customer does not choose anything the frame should be suppressed. I understand I can wite a rule - where should I place it to work properly. TIA
__________________
FusionPro 6.0P1e Designer, Acrobat 8.1.4 Pro WinXP SP3 |
|
#2
|
||||
|
||||
|
I'm not sure I understand the question. Where is this "drop-down menu" that you mention? If it's on a web page in FusionPro Web, and your question is about how the selection in that drop-down menu should be used in the job, then you might want to ask in the FP Web forum. As far as I know, it should become a field in the input data. If it's a list of file graphic names, then I think you can use the CreateResource function, although if it contains resource names, then you may need to use the Resource function instead.
In FP Desktop (the Acrobat plug-in), you can create a Graphic rule like so: From the menu in Acrobat, select FusionPro -> Edit Rules, then click "New", change the Rule Type to Graphic, under "Select a Rule Template" choose "Empty Rule," then click "Next." Then enter the logic for the rule; exactly what this should be obviously depends on what you're trying to do. I think you want something like this: Code:
return CreateResource(Field("MyDropDownFieldName"));
With logic like the above, if nothing is selected in the drop-down list, then the rule will throw an error, which should result in nothing being shown in the graphic frame in the output. If you want to suppress the error message in the log file, you can catch the exception and return NullResource like so: Code:
try { return CreateResource(Field("MyDropDownFieldName")); }
catch (e) { return NullResource(); }
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Super Moderator Printable Technologies, Inc. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant warning messages. For font-related issues, please check your fonts.err file. The correct spellings are JavaScript and FusionPro. Acceptable abbreviations are JS and FP. Please do not refer to JavaScript as "Java"; they are two completely different languages. Check out the JavaScript Guide and JavaScript Reference! return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
|
|
#3
|
||||
|
||||
|
Something like this might work for you, assuming you have a graphic frame named "TestFrame", and the following graphic rule applied to that frame:
Code:
var MyPic = CreateResource(Field("VariableGraphic"), "graphic", true);
if (MyPic.exists)
{
return MyPic;
}
else
{
var MyFrame = FindGraphicFrame("TestFrame");
MyFrame.suppress = true;
return NullResource();
}
|
|
#4
|
|||
|
|||
|
Thank you so much - will try tomorrow.
__________________
FusionPro 6.0P1e Designer, Acrobat 8.1.4 Pro WinXP SP3 |
|
#5
|
||||
|
||||
|
Okay, well, you didn't mention that you wanted to suppress the frame so as to prevent text in a different frame from wrapping around it. That only came to light as a requirement in your other thread:
http://forums.printable.com/showthread.php?t=715 And the solution is the same as what invaricconsulting posted above: http://forums.printable.com/showthre...=2316#post2316 Also, I didn't say that you had to move the post to the other forum, I just didn't understand what you were asking. So I apologize for being confused, but I was simply trying to answer the question that you actually asked, which was: "where should I place it?" A better question would have been, "How do I suppress a graphic frame to prevent text from wrapping around it when there's no graphic content?" The fact that you're getting the data from a form on FP Web doesn't really affect the answer to that question. Anyway, I think we're all on the same page now.
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Super Moderator Printable Technologies, Inc. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant warning messages. For font-related issues, please check your fonts.err file. The correct spellings are JavaScript and FusionPro. Acceptable abbreviations are JS and FP. Please do not refer to JavaScript as "Java"; they are two completely different languages. Check out the JavaScript Guide and JavaScript Reference! return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
|
|
#6
|
|||
|
|||
|
Dan,
thanks. Indeed the correct question is a 90% of correct answer!
__________________
FusionPro 6.0P1e Designer, Acrobat 8.1.4 Pro WinXP SP3 |
|
#7
|
|||
|
|||
|
I am trying to use the rule suggested by Invarico above; however, it is not returning any results. I must be doing something incorrectly. I have copied the code exactly and changed the reference of the "testframe" to the name of my actual graphic frame.
The result I am trying to create is for a newsletter. We have headshots of clients with their name and contact information to the right of the image. If the photo is not present, I need the text to slide (or unwrap) to the left or edge of the text frame. This is the code I am using (we are pulling images off our network): Var1="MA Grid::Photo Filename"; Var2=".jpg"; Var3="G:\\Team Tools\\Digital Docs and Production\\Field Sales Photos\\MA MRC Photos"; Var4="none"; temp = ''; var_extension = ''; has_extension = ''; if (Var3 == "") Var3 = Var3; else { if (FusionPro.isMac) Var3 = Var3 + ":"; else Var3 = Var3 + "\\"; } for (i=0; i<Field(Var1).length; i++) { temp = Mid(Field(Var1), Field(Var1).length-i,1); var_extension = temp + var_extension; if(var_extension == ".png" || var_extension == ".pdf" || var_extension == ".gif" || var_extension == ".eps" || var_extension == ".tif" || var_extension == ".tiff" || var_extension == ".jpg" || var_extension == ".jpeg") { has_extension = "true"; i=Field(Var1).length; } else has_extension = "false"; } if(has_extension == "true") Pic = CreateResource(Var3 + Field(Var1), "graphic", true); else { if(Var2 == ".jpg") { Pic = CreateResource(Var3 + Field(Var1) + ".jpeg", "graphic", true); if (Pic.exists) Pic = Pic; else Pic = CreateResource(Var3 + Field(Var1) + ".jpg", "graphic", true); } if(Var2 == ".tif") { Pic = CreateResource(Var3 + Field(Var1) + ".tif", "graphic", true); if (Pic.exists) Pic = Pic; else Pic = CreateResource(Var3 + Field(Var1) + ".tiff", "graphic", true); } if(Var2 == ".png" || Var2 == ".pdf" || Var2 == ".eps" || Var2 == ".gif") { Pic = CreateResource(Var3 + Field(Var1) + Var2, "graphic", true); } } if (Pic.exists) { return Pic; } else { var MyFrame = FindGraphicFrame("MA Photo"); MyFrame.suppress = false; return NullResource(); } Any help you can lend would be great. ~ Christian Acrobat 9 Professional, FP Desktop 6.1, Windows NT |
|
#8
|
||||
|
||||
|
Quote:
Actually, I think that all you need to do is this, in a text rule: Code:
var filename = Field("MA Grid::Photo Filename");
var pic = CreateResource(filename, "graphic", true);
if (pic.exists)
return pic.content;
Print("Graphic not found: " + filename);
return "";
__________________
Dan Korn FusionPro Developer / JavaScript Guru / Super Moderator Printable Technologies, Inc. Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant warning messages. For font-related issues, please check your fonts.err file. The correct spellings are JavaScript and FusionPro. Acceptable abbreviations are JS and FP. Please do not refer to JavaScript as "Java"; they are two completely different languages. Check out the JavaScript Guide and JavaScript Reference! return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|