Jump to content

ThomasLewis

Members
  • Posts

    294
  • Joined

  • Days Won

    11

Everything posted by ThomasLewis

  1. In the composition menu under Output, change Optimize over to Basic. Advanced will significantly slow you down.
  2. It's not working because you are filtering on the length being greater than 4. Your shortest length is "Cell: " which is 6. Anyways, that wont work with the formatting you want. Give this a shot: function format_phone(prefix, phone_num) { if (phone_num) return '<span color="Red">' + prefix + ": " + '</span><span color="Blue">' + phone_num + '</span>'; else return false; } var numbers = [format_phone("Office", Field("Office")), format_phone("Direct", Field("Direct")), format_phone("Cell", Field("Cell"))]; return numbers.filter(Boolean).join(" "); Edit: The forums turned my "& # 32;" into a space (without the spaces between them). You will need to use that entity instead of a literal space character in the join(" ")
  3. Even though the old UI looked dated, I do miss it. With that said, I have been using the new(ish) version since it came out and have gotten used to it. You really have to be diligent about collapsing the sections if you don't want to scroll and using ctrl + scroll wheel to zoom in (not sure what this would be on the mac). My one request would be to let it save some defaults. Like always having it start up with bleed set, a specified press sheet size, and having the primary step default to Stack. I realize you can just open an existing imp file, change it and do a save as, but having defaults would be really great. At the very least, let it save my zoom level.
  4. I'm trying to see if its possible to use MakeQRBarcodeGraphic in an external JS function that is loaded into OnRecordStart. The MakeQRBarcodeGraphic function is working fine and returns a Resource but when FindGraphicFrame("frame").SetGraphic(qr); is called, I end up with an error that says it needs to be a graphic resource. I'm wondering if this is possible or if the only way to get it to work is through a specific graphic rule, otherwise what step am I missing?
  5. You can put this in OnRecordStart FusionPro.Composition.repeatRecordCount = parseInt(Field("print count")); But that doesn't seem like a very efficient way to do this. It may be better to look into a way of automating the quantity in the print queue, which would be specific to your rip/print device.
  6. This is not a long term solution, but you should be able to setup a batch process with an action in Photoshop. You would need to batch open each image, use the layer as a selection mask, crop, then save as a PDF. The PDF wont show the checkerboard background but it should retain the transparency in FusionPro.
  7. You can assign global variables in OnRecordStart by omitting the "var " before the assignment. Then in your other rules put this bit in the top line: if (FusionPro.inValidation) Rule("OnRecordStart"); That way when the rule validates, it will load them in and not give you an error that they are not defined.
  8. Please see the attached imposition. There seems to be 2 bugs happening. This has been tested under version 11.0.2 and 11.0.8. First the imposition should be HorizontalPosition=-0.145 " but this converts to a positive number upon opening the file. Second, PrimaryRepeatInfiniteStack=True does not stick, this reverts to unchecked, or false. It looks like there is an issue where the next line, where the value should read PrimaryRepeatSpacing=0 " is being omitted and the 0 is appended to the true line. Check the file in a text editor before making any changes and you can see neither of these values will stick when making changes. IMP_6x11_2up_Imp.fpi
  9. Change the 14400 to whatever your frame width is (or just slightly under). Value is inches times 7200. if (Field("Phone") && Field("Email")) return '<p br=false quad=L tabstops="0;14400,Right">' + Field("Phone") + '<t>' + Field("Email"); else return '<p br=false quad=C>' + Field("Phone") + Field("Email"); Explanation of whats happening here. First you are evaluating if there is a value in both fields, if so then you are replacing the default tabstops with only a right aligned stop at the edge. Then placing the value of both fields separated by a tab. If both fields do not have values, then you are replacing alignment with center and returning the value of both fields, only one of which will have something in it.
  10. I tried emailing support 3 times and I keep getting rejected due to some seriously aggressive spam blocking. I removed all links and even sent a non-html version and its still rejected.
  11. There seems to be an issue when Tif files saved out of Photoshop have Jpeg compression turned on. FusionPro (both 10 and 11) will render a PDF but the images are flipped upside down. Fortunately the Indigo rip throws an error on these and fails to rip which prevents them from being printed. I'm wondering if this is a known issue. I can send samples privately if support wants to take a look.
  12. ThomasLewis

    UPC Help

    Change the line that is retstr = "0"+Field(Var1); to this: retstr = Field(Var1); if (retstr.length < 11) { retstr = "0" + retstr;} I'm not sure what the warning is but you might try this to replace that last part: if (Field(Var1)) { final_data = '<span><f name="' + Var6 + '">' + NormalizeEntities(MakeUPCABarcode(retstr)) + '</span>'; return final_data;} else { return "";}
  13. It looks like the only thing that is really variable is the Exam #. You could create a rule that is put in a text frame on each page that looks something like this: var form = Math.ceil(FusionPro.Composition.currentPageNumber / 14); var exam = (FusionPro.Composition.outputRecordNumber -1) * 4; return form + exam; It will output just the Exam # as you iterate through each version. It is important to check the box that says "Re-Evaluate this rule for every text flow" so it will properly get the page number. Basically what's happening here is you are getting the page number the text frame is on and dividing by 14. So page 8, for instance, would be 0.57 and then rounding that up to a 1. Page 15 would be 1.07, rounded up to 2. That takes care of your forms in the 56 page template. Next you need the exam number but that will continue to iterate up as you go. The outputRecordNumber will keep count of that. If you start that count off with 0 instead of 1, you can multiply that by 4 to get the iteration to go up by 4 for each record. ie record 1 = 0 (0*4 = 0), record 5 = 16 (4*4 = 16), then you add the form number, making record 1 = 1-4, record 5 = 17-20, etc.
  14. Sorry if I confused the issue with the product names. The server itself has the API on it. In this particular case, it's just used to compose jobs being sent to Producer. I understand everything you are saying and understand the limits and intent of the product. I will try to elaborate on the workflow. The client sends a data list to an account manager who then creates a job number. A folder is created on a file server which is named the job number. The data file which is named by the customer is then placed in that folder. So it might look something like this: //SERVER/Jobs/12345/filename.csv The data team then gets the job. They simply open the PDF FusionPro template and define the data file. Then the job is composed using the FusionPro Producer server. The job is then sent off to the other server which has no knowledge of the file server where the original csv came from. Inside the template is an OnNewOutputFile rule. var template_name = "MyTemplateName.pdf"; FusionPro.Composition.outputFileName = get_job_no(template_name) + "_MyOutputName.pdf"; When this file is then sent off to the server for composition, FusionPro.inputFileName of course gets a new path local to the server, no longer the original path to the csv. This makes perfect sense. I'm not questioning that at all. What I need is to get the folder name (the job number) from the original path of the csv so the output file can be renamed with the job number. This is the only place where the job number would reside as its not part of the csv or of any other rules being brought in as data. The original input file path is preserved in the def file in the server working folder: <?xml version="1.0" encoding="UTF-16"?> <!--Data Source Definition file generated by: FusionPro(R) VDP Server 10.1.9 (http://www.pti.com)--> <DataDefDict MajorVersion = "7" MinorVersion = "1"> <Assembler> <DataSource FileName = "..\..\Jobs\[color="Red"]12345[/color]\filename.csv" Type = "Delimited Text" Delimiter = "," FirstRow = "true" TaggedStrings = "false" Encoding = "default" /> The function posted earlier reads the def in as an external data file and extracts that job number so when OnNewOutputFile runs, it can properly rename the output file with the job number. With the output file named with the job number prefix, it can then go into a queue to be proofed and so forth. What would be ideal is to avoid having to read in the def since FusionPro already knows that path. If there was a function to grab the original data file input path, instead of the current path the server needs at composition, this would be pretty straight forward. I really hope this clears things up. As it stands, the problem is solved, it just feels clunky.
  15. The job is a regular template in acrobat that is then sent to the API server for composition. What happens is data files are placed on a file server in a folder that is the job number. The input file itself is named in a predictable way but does not contain the job number, only the folder it's in has it. The workflow is that the template is opened and the input file assigned, then it's sent to a producer server for composition. What I am attempting to do is read the folder name, ie the job number, and then rename the output file prefixed with the job number. I did end up writing a function that reads in the def file to grab the job number. It works fine for this job but it seems like there should be an easier way to do it. The frustrating thing about this function is I have to hardcode in the template name and hope no one changes it or the def file wont read. It would be really nice if there was a way to read the original input file path, which is already preserved in the def file. It would also be nice if the PDF template name was also preserved somewhere. I know I could have used that a few times on other projects. If you have any other ideas on how to achieve this, I'd love to hear them. Here is the function I currently have working to get the number from the def file. function get_job_no(template_name) { var iname = FusionPro.inputFileName; var job_no = iname; //get number from iname in case job is composed locally if (FusionPro.Composition.isBatch) { var iname_path = iname.replace(/[^\\]*$/, ""); //gets path without file name var def_name = template_name.replace(/.pdf/i, "") + ".def"; var XDF = new ExternalDataFileEx(iname_path + "\\" + def_name, "\t"); job_no = XDF.GetFieldValue(8, 0); } return job_no.replace(/.+\\(.+)\\[^\\]+$/, '$1'); //gets last folder name from iname or XDF }
  16. I'm trying to grab the name of the folder the original input file came from. FusionPro.inputFileName doesn't work because it changes to the path the scheduler uses once the file is composed. I see that there is a somewhat relative path in the def file which contains the folder name. Is there any way to get that path?
  17. Here's how I would do it: pagesInPDF = 0; markupToReturn = ''; PDFresourceRef = CreateResource(Field("PDF"), "graphic", true); //Find out how many pages it has pagesInPDF = PDFresourceRef.countPages; //Page usage loop to turn pages on based on pagesInPDF for (i = 1; i <= pagesInPDF; i++) FusionPro.Composition.SetBodyPageUsage('p' + i, true); if (pagesInPDF < 16) FusionPro.Composition.SetBodyPageUsage('alternate', true); //Graphic frame loop to specify which pdf page goes into which graphic frame for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++) { var frame = FindGraphicFrame('p' + pageLoop); PDFresourceRef.pagenumber = pageLoop; frame.SetGraphic(PDFresourceRef); } return markupToReturn; I don't know what you are returning there though, seems blank, but I left it in for whatever reason.
  18. With the previous way I was trying to do this, where the only javascript in the entire template was the Load function, no errors appear at all at save and validation only would result in a "null" message. This is why I was trying to change that message, I was just unaware that could not be done fully in the external file when everything else in there was working just fine. Whether it is supposed to execute or not, everything in the actual production JS file I was loading in did preview and render in the final output. Now that I am calling it as a function, I get the proper errors that you would expect. It all make's a lot more sense now thanks to both of your help.
  19. Adding that extra function call directly to OnRecordStart did the trick. It's working perfectly now. It's just a matter of updating all the templates to include that extra line. Thanks so much for all the help
  20. Attached is my template with the external JS file. When you open OnRecordStart and click validate, it returns "null". If I paste the code from the JS file directly into OnRecordStart, it returns the error as you would expect. I get where you are coming from trying to keep things organized. Hopefully this will make more sense with the attached sample. errortest.zip
  21. Those examples were all very helpful. I'll try to explain where the issue is. I have a series of templates that all use very similar javascript for the OnRecordStart callback but also require the operator to modify the text frames on a per job basis. Instead of maintaining all the code in each template I am using the Load function to bring in a single JS file. These templates will be used by operators that would be unable to diagnose javascript issues but can understand errors returned by validation. The thought was to have them simply open OnRecordStart and tap the validate button. If everything checks out, great. But if one of the text frames is missing, then it would return an error specified in the script. This is where my confusion came in. If you put return "test" directly into OnRecordStart, it will actually return "test" to the user. However, if you put return "test", or anything else, into an externally loaded JS file, it returns "null". I was attempting the try/catch method and instead of nothing happening, I wanted to use return to return an actual "hey, you forgot to put in the text frame", instead it returns "null". So, the examples all work fine, I guess the real issue is I am unable to return a custom message when text frame is not found.
  22. Sorry to pull up such an old post but I was unable to find anything similar. I'm running into the same issue where I need to check if a frame exists in validation. Using the Try/Catch method still causes the validator to return "null". Is there any way around that?
  23. If you look back at my very first post in this thread, there is a bit of vital information there to get this to work. In the imposition, you have to set the stack to 1. I've attached a revised version of your fpi file.85x11_30-up.fpi
  24. EDIT: I think I misunderstood at first, this should work: FusionPro.Composition.chunksBreakStacks = true; var amount = parseInt(Field("Unit")); FusionPro.Composition.repeatRecordCount = amount; var rrn = FusionPro.Composition.repeatRecordNumber; if (rrn == 1) FusionPro.Composition.StartNewStack(); FindTextFrame("Content").content = '<color name="' + Field("Group") + '">' + rrn + " of " + amount; The CSV should look like this: Group,Unit Red,20 Green,15 Blue,32
  25. I'm not real sure what you are trying to do based on your brief description. If I had to guess, you have something like: Red, 20 Green, 15 Blue, 32 Then you want 3 separate output files with an imposition populated with the count indicated?
×
×
  • Create New...