chr1shardcastle Posted May 26, 2009 Posted May 26, 2009 Hi, I have a invoice database set up in which I'd like to control whether or not certain objects print through a script. The reason for this is that I either print an invoice onto headed notepaper or export it to pdf. If I'm exporting it to pdf I like it to have the company logo/details included in the pdf but when I print it I want these omitted (as they're already on the notepaper). At the moment I have added the logo/details in a layout and then manually set them to print or not print depending on whether I'm exporting to pdf or printing. What I'd like to be able to achieve is a button which runs a script setting the state of the logo/details to print and then exporting the record to pdf. Or at least that's my way of thinking about it. Might be simpler ways out there?? I'm not particularly up on scripting in filemaker but any help much appreciated. Thanks.
chr1shardcastle Posted May 26, 2009 Author Posted May 26, 2009 I've thought of a simpler way round this by just duplicating the sheet and have set up a button to export to pdf using the Invoice Number as the filename. The logo/details are set up to print on one and not the other. If there's a better way I'd be interested to know?
IdealData Posted May 26, 2009 Posted May 26, 2009 You could have the graphics and pre-printed stuff evaluate into calculation fields. Use a check box marker to print to "PDF" or "Paper" and evaluate the contents of the graphics based on the check box. The method you chose is absolutely fine though.
chr1shardcastle Posted May 26, 2009 Author Posted May 26, 2009 Like the sound of that but I'm not sure how to 'evaluate the contents of the graphics'. i.e. how can I determine whether or not something prints or not? Not obvious to me in the scriptmaker.
chr1shardcastle Posted May 27, 2009 Author Posted May 27, 2009 OK, so bit more detail on this. So far I've got to the point where I have a button I've called 'Print Options' and a checkbox (called Print) with options for 'PDF' or 'Print'. Pressing 'Print Options' calls a script I've called PrintWhat [color:red]If [MFNorth Invoices::Print = "PDF"] Perform Script ["PrintPDF"] Else If [MFNorth Invoices::Print = "Print"] Perform Script ["PrintPaper"] End If PrintPDF (Gets invoice number and exports pdf with inv no for filename) [color:red]Set Variable [$Path; Value:"file:../../../Desktop/"] Set Variable [$Filename; Value:MFNorth Invoices::InvoiceNumber] Set Variable [$FilePath; Value:$Path & $Filename] Save Records as PDF [Restore; No dialog; "$FullPath"; Current record] PrintPaper [color:red]Print [] So I've got to the point where I can check the relevant box and then either print or export to pdf accordingly. If I could just add to the print script to turn off the graphic elements I'd be a happy bunny! Any further advice much appreciated.
chr1shardcastle Posted May 28, 2009 Author Posted May 28, 2009 I know I'm talking to myself here but if this helps anyone else I've resolved this now. All I did was create a field called 'Logo' and made it a container. I then added the logo/image to it (In Browse mode right click on the container and add the image). I then placed this container outside of my page set up (i.e. out side the print area). I then added another field called 'PrintLogo'. This was a calculation with it's result being a container. Calculation was: If ( Print = "PDF" ; ( Logo ) ) Now when I select PDF in the checkbox (as per earlier post) it loads whatever image you add to the container 'Logo'. I then repeated this for some other elements I wanted control of. I'm not sure if this is the best way of getting about this but works for me.
Recommended Posts
This topic is 5658 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now