Skip to main content

PDF Calculations

Lesson 14 from: Creating Interactive PDFs

Jason Hoppe

PDF Calculations

Lesson 14 from: Creating Interactive PDFs

Jason Hoppe

buy this class

$00

$00
Sale Ends Soon!

starting under

$13/month*

Unlock this classplus 2200+ more >

Lesson Info

14. PDF Calculations

Next Lesson: Interactive PDFs

Lesson Info

PDF Calculations

So what I'm gonna do is I'm gonna open open in design file here that I have set up and this in design file that I'm using is going to be a invoice for a fish company. So I've got this and I'm going Teoh, open up My invoice here and here is my invoice. This was designed in design. Everything looks good and you'll notice that there are no rose. There are no cells. There are no anything. So of course, what I did is I use that little trick that I just taught myself by watching this class. I'm gonna put lines in and another layer here. So a separate layer here with these lines cause they don't want to use to show up. But I want to be able to propagate these fields when I go into in design or when I take it from in design into Acrobat. So this is my invoice here. I want to take this, be able to go in and create fields and just do some calculations here. So I've got this file export. I'm going to export this and print. Pdf is just fine. I clued you save. Make sure that I have layers selected.

I do that by Acrobat six or higher compatibility on the view The pdf after exporting Click. OK, and there's my file under tools at the form Yes, I want to do the auto detection comes back and it's done an awesome job for me. Thanks to those layers that I put in there. Close the form editing. Go back over to my layers here and turn off those layers so I can see my form. Fields are all nice and happy right there. Back at it. That's where we are. Great. These are a little close together here. And so I'm just gonna go through and get rid of this first set here all the way across, and I'm gonna distribute these out a little bit better so I can drag over here, use my up arrow, Put these where I want them to be. There is my down arrow to put these where I want them to be. Choose them. All right. Click on them. She's distribute, distribute vertically, and it's going to distribute them all vertically. But unfortunately, this is a great thing right here. Um, when I did this, I need to do these set by set because even though we selected them all here, it wanted tried to go ahead and distribute each one of them individually. So I need to do it row by row here, so distribute vertically. There we go distribute vertically back through and you'll run into these quite often. You would think that if we select all of our top row, there is no grouping, so we can't go in and group these together and make it one unit. What it did is it looked at every single one there and distribute everything vertically based on every single item, which kind of give us that stair step effect. If it doesn't make sense, try it. You will see what happens. So, I mean, just right clicking on every single one of these sets that I select and then align these vertically. It's based on the one that's on the top and when it's on the bottom there as well Close the form editing there. Yep. There we go. So now I've got all my items to find here, So I'm gonna go ahead and I'm gonna set up some calculations here and what I want to do here is I can just type in the item number and the item description, but I want to help the number ordered in the number ship in the purchase unit in the case cost and then my extension. So I'm gonna do some calculations here. Well, under the ordered one, I'm going to make sure that we have our names correct here. And with that, my tool tip as well. Always do this under the options. Here it's going, Teoh, go in and dio limit of, say, 1000 characters because I can't have you order more than so I can put a limit if I want to hear, don't have to. Under the format, it's definitely going to be a number. And I want to make sure the number is zero decimal places. I don't wanna have you order 1. of these, so make sure that it's a number right there and I can do the same thing on each and every one of these as I go select all these. But what I'm gonna do is I'm gonna select all of these. I'm gonna right clicking them and do the properties so I can set the appearance overall is we're all gonna be nine point. And the options here is I'm going to go ahead and limited Teoh, you know 10 characters right there as well. I want these to be all the numbers so that they're all numbers with no decimal places. And by selecting them all and right clicking on the properties here, you'll notice I don't have the ability to go under format here when I select multiple items. Unfortunately, with a format, I need to do that one by one. So with a format, it's going to be a number with zero decimal places like this one. Format number zero decimal places. You notice how this whole screens just shifted over for me? It does that automatically when it covers something up. No, that wasn't one of those freaky things. It really did happen. There's my extension format. It's a number no decimal places right there. So we click close. So now what? I want to dio iss. I'm just gonna close this so I can see so I can have 12 ordered six of them shipped, You know how much Oh, it's the purchase. The purchase unit. How much are they? Piece. Okay, so I probably put a dollar sign in here if I want to. So I'm gonna go back into the edit menu, and this is going to have a dollar sign so I can choose the currency symbol under format so I can use a dollar sign. It'll automatically put that in there, and I'm gonna go into my case cost to as well Use the currency symbol. And the extension as well is also going to be have the currency symbol on their great. So I can do that and I can check and see. So if I put in 12 it becomes $12. Oh, you know what? I need to decimal on that? Because what happens of its $12.35? This is why we go through and we test it. So I do need to decimal places on that one. I do need to decimal places on that one and two decimal places on that one. Great. Now we've got that set. Now I can see how that looks. So $15.36. Yeah, that's great. So now what I want to do is I want to be able to see how to calculate thes fields really quick and easy. So in order to calculate fields here, it's a bit of a tedious process. Clear the form fields here. This is how I calculate in the fields. So I want the extension to be this. So if I'm going ahead and the purchase unit here, um, how many ordered How many ships I'm not gonna build for the number that are shipped right here. So the number shipped is right. Finds our extension here. The extension. How do I calculate this? Well, I want to go in, and I want to add these altogether. So under calculate, I'm going to say the value of this extension is going to be some or the product of what, fields. Well, it's going to be the products of what feels well, I'm gonna have the number shipped by the actual case cost right here. So I picked those fields that I'm working with. And here's yet another reason while you go in and you label all of your fields right here. In fact, I'm gonna have to do that so that I can actually make us so it there's a whole lot easier. So that shipped that's purchased unit case cost and the extension. Like I said, can't spell. Here we go. Now I've got these all labeled, So there's my extension. I click calculate, and it's gonna be a some of what field. So I picked the fields here. So this is the entire list of fields. This is a really tedious process. If you're going through and working with this and the reason why I left all these in here is because in order to do this for every single one you gotta deal through and do this, I wish there was a much faster way to do this. This is kind of tedious. So the extension is going to be my number shipped. So I want to calculate from the number shipped here, plus the case cost together, and I click. OK, so the value that's gonna come up in extension right here is going to be the number shipped, plus the case cost because this is plus right here, and that's we haven't It's like now because the number shipped, it's going times the case cost. So I'm gonna do product of thes too. Well, there it is. Shipped. Plus, the case cost down. I click close. So let me go into preview and see how this works. So we've got 12 of them shipped in the case cost us $13.56. Wow! 160 to 72. And it's interesting that I'm in preview mode here, and it's showing me all of my lines that are right there. So what I'm gonna do is I'm gonna go through here and I'm going to you under my layers here and emerge my layers together. So they have that. So I have to do the tedious process of merging my layers. There we go merge my layers together. And I didn't want that because it merged my layers without shutting him off. And, of course, by doing that, it went ahead and turned those layers on right behind there. But never fear. I can use my fantastic replaced feature, which I can take my new pdf right here, swap it out for the old one behind there and be able to get that back without any problem. Okay, so there it is. This has all these lines behind here when I merged altogether. I don't want those lines, so I created a new pdf without those lines going to replace. Swap this in here. Invoice with no lines. Select it. Replace it. There we go. Now, my invoice has no lines behind there. Like I said, things move faster. Okay, now that that's taken care of, I could go back to my forums here under the editing. Well, this is great. So if I shipped 36 of them in the case costs is that it automatically updates that right there. Wow, isn't that fantastic? Well, I realize you know, this purchase unit here is actually the discounted price right here. Or you can do the number ordered by the number shipped in the extension here so I could go back in here and I can work with a whole bunch of different things right here. So what happens if I try to go in and I try to do some other type of calculations here? I've got all types of calculations that Aiken dio Any one of these fields can be calculated. But you notice when we go through and we do something like this like the extension. We only have some or the product here. So if we were doing something where we had a negative number in here, we could go in and we could show the negative number. So, like, we had a discount of some sort. Well, under any one of these here, like to purchase unit, I may have ah, format here. That's a number. So I could use a negative number so I could actually add a negative number two something so that I would get, um, the net something so I can actually go in. And if I used a negative number here, I could go ahead and show this under the format here is being read text so that if I do a negative number, it will go ahead and show a negative number in here. So when I go under here and I do like a dollar here, this is actually the discount that I get because it's showing in red so I can set that up. So it shows in red, and I have that as being the discount, which is great. So I could actually factor the discount in here, and if I actually wanted Teoh do the actual case cost. I could add this together with this multiplied by this to get my extension here. So that works. So doing the addition of a negative number is basically our way to go ahead and subtract, which is kind of interesting when you go through and do that. But then we run induce a few other interesting things right here. Once we get down to the order total, that's easy, because I can go, and I can select my extensions here. And I could if these were all extensions here, I could go ahead and put in my order total. So it would be the addition of all my extensions right here. And then I could add on my afraid in my miscellaneous, but then I have to go in and calculate my sales tax. Well, how do I calculate my sales tax here? Well, this is the tricky part going to get rid of all this other stuff here, so we don't get we don't have to work with all that. So my order total here is going to be all my extensions. So I'm going to create a text field right here that is my order total. And that is going to be again. I can't type o R D e r. There we go. Order Total. That calculation is going to be the sum of every single one of my extensions. And if I had multiple ones who would just add every single extension together right there for my order total, That's great. I could also go in, and I could do my freight and my miscellaneous. So if I do my freight in my miscellaneous here as well, those two are going to be text fields. And so that's gonna be my freight, and that's that. And I'm gonna do my miscellaneous here by copying this and just changing the name of it to be miscellaneous, and then I need to go in, and I need to calculate the sales tax. Well, I need to calculate the sales tax on the order total, which is the sum of all my extensions. We need to add in the freight I need to add in the miscellaneous, and then I need to put in my sales tax. Okay, So in order to do this, this is where it gets kind of crunchy an acrobat here. I didn't go in and put a total and then a sales tax here. So what I'm gonna do is I'm going, Teoh, create my sales tax right here. But I have to calculate my sales tax on adding all these three together. So I'm going to create a text container over here all by itself, which is just gonna be my total amount before tax. Now, I don't have a place to do this. I don't have a line right here, so I'm just creating a field off by itself. Right here. So this is gonna be my total amount before tax because they need to generate this number and put it someplace before I can calculate this. Okay? This is not like Excel where you can just have it all done. Now you gotta walk through. So I want my total amount before tax. Even though this is not part of the pdf right here. They don't need to see this. I need to put this in. So what I'm gonna do is I'm gonna use my calculate field, which is going to be the some of what? It's gonna be some of my order total. So I go and I say, There's my order total right there, plus the sum of my freight, which is right there, plus any of my miscellaneous costs, which is right there, and they're all going to be right there. So let's see how that works. Click on a preview here, my freights, 100 bucks or $1000. bucks miscellaneous 123 56. I do that and there is my total right there as my field. But I don't want this field showing up in my document there so people can see it there. So there's a couple things that Aiken dio one. I can take this and I can go into my appearance right here. And I could make the text white so that you don't see that order total showing up in there as well. I could also make it so that it's like really small font size. You wouldn't even know that it's there and make it white, because what I need to do is I need to have some place to park that number. It's not just a number that flows there like Excel works. I could take that number, then you add it there. I need to have it someplace. So I'm gonna keep this is black right now so we can see that. But in reality, I wouldn't want somebody to see that it's there. But you can do that. So then I have to go in, and I have Teoh calculate my sales tax while my sales tax is going to be the amount on here. So I'm gonna then draw another container here for my sales tax. Take my sales tax and this is going to be my final sales tax right here. She's all properties. And in this case, what I'm going to do is I'm actually going Teoh, calculate the sales tax, not just the sales textbook. Add it to the entire amount as it stands. So But the sales tax, what they would do is I could go in, take the product of the amount before sales tax here, the total before sales tax. So I could do that. And that would be these so I could delete all this. So it's used pick. I have to get rid of all these. Okay, So the value of my sales tax here is going to be the product of this as I go. Problem is, is that once I put this sales tax in here is gonna show me the number. And then I have to add all this stuff together. So there is my amount. There's my sales tax and I'm going to take the product of my total amount before tax and when multiplying it by What is that? What? Why what's my sales tax when there is no way that says OK, I can take this field here and multiply it by a certain number. I need to take a field and I need to do something else in the field and it's like, Oh, so what I need to do now is I actually, and this is this is really weird. I need to create another field here, right here. This is my hidden sales tax here, cause we're gonna hide this amount right there, and that's what it iss. And in this amount here, I'm going to put in my sales tax and I have to put in my sales tax amount, which is 1.95 for Seattle. That's my sales tax amount, right there because there is no way to calculate in me to put in a number. That number is coming from that field, so that number has to be in that field because there was no other way to do that. So now I have to take my total amount and I have to multiply it by my hidden sales tax in order for this to come up. So there's my field. It's gonna be the product of my total amount before tax right there and my hidden sales tax here, which is a number that I have to have in that field. If I have no number, it won't get calculated hidden sales tax and I click. OK, so now if I go in and close the form editing here and see how this works, then I can go in and have my order. Total afraid. 56 bucks, my miscellaneous. Here, 1 54 there it is. And that amount should calculate based on what I just did not doing it before sales tax. Now I cleared it all out of there. That's why nothing like screwing this up. So I had actually dentally gone in there and cleared this out. So we need to go back here and say OK, pick these things. It's going to be the some of my order total. It's going to be my freight, and it's going to be my miscellaneous altogether, which is going to give him a month before tax I cook. Okay, then check the preview here. There it is. My order total is 406 80. I'd probably want to make sure that goes to two decimal places. By afraid is $56 by miscellaneous has actually won 25 60. So my order total is 5 40 But here's my tax amount. So this is my total amount of my file right there. Well, if somebody is filling out this form here, I don't want them to be able to go in here and be able to change these amounts because what happens if it's like, Well, I don't like that sales tax. I'm just gonna go and I'm gonna change it because it's an open form field, right? So I could say now, my tax rate is really point to three or and I do that. And now my total amount is 1/4 of what it should be. So I want to be able to have these in here so that I can put in the amount there. So it's calculated, So I want to have these fields hidden. Here's the trick in order to make a field hidden so you can't see it, we have to make it active, put the amount in there and then hide it afterwards. Like I said, calculations are great, but there's a lot of little loopholes that you have to go through. If you know how to deal calculations in excel, it's great, but this requires a few extra It'll things. So I'm gonna have my hidden sales tax right here and I've created this. I may have to close out of the form editing, Put the value in here, then go back under the edit menu, click on the properties here, go to a general, and then I can go ahead and make this hidden. Or I could make this read only if I make this read. Only I'd want to go back in and set this type toe white so we can't see it and read only so somebody can only read it. They can't go in and physically edit it right there. Now, if you had Acrobat Pro, yes, you could go in and edit it. But if you had reader, you wouldn't be able to edit that file because would be read only. So if I choose, read only here and make it visible. Now I do that. Now. I close the form editing and I try to change that right there. You see how that's no longer an active form field? If I change that toe white and move it off to the side, they're down to the bottom. I would know it's there, but I have to have those fields there so it could be visible or not. So if I make this non visible right here, read only and make it hidden as I close that whole thing and then close out of there, I won't see it. It's still there, but of course I can't get to it until I go back under the editing and then get it back in there. A lot of steps, but these were always to be able to go through and calculate because I can't go in and just say, add this amount to it. The amount has to come from a form field. If it's not in a form field, it won't calculate. If it's in a form field, anybody can edit it. If you want to make sure they don't edit it, you can either hide it or make it read only or hide it in a way that they can't see it. So you have editing capabilities of it. Now, if you have the full version of Acrobat, yes, you can edit it. If it's done for reader and you say it's hidden or its read, only you be able to see the amount of the tax. But nobody can go in there and actually change this. I've done this for multiple people that they wanna have their salesmen go in and have forms. They were using word before and typing out inward. All these things well, we do this, and every once in a while they call me up and they're like, Oh, we change the form, not a problem. Take it, swap it out from behind there. Everything's there. But the calculations are quite awesome. Toe have. They're keeping in mind that we have no way to put in numbers. The numbers have to be in the fields themselves. What, you put the number in the fields, Anybody can change them. So you have to go in and make sure there is visible or hidden or read only with that as well. So fun with calculations, Yes, makes me appreciate excel. And I would never thought I'd ever say that. I always get stumped on calculations, because inevitably, as you saw there, when I had this, I had gone in and inadvertently erased all the additions into that one, and then all of a sudden, it doesn't work. And I'm not that great at math. And so calculations I really struggle with, and so you have to go through. And it's like, Okay, this one times, this one minus this one. Plus the square root of that becomes this With this field over here, that's calculated this way. As long as you're great with math, you can go ahead and follow through with this. Just keeping in mind that you have to just make sure that the fields you select are the ones you want to calculate. Yeah. Curry. All right. We have a few questions on this really, really wonder. Just so straightforward. A question from California is, how do you handle sales tax for more than one state? Can we file? See, Can the file see which state is applicable to the invoice? No, you'd have to go through when you'd have to choose which one was which. You probably could go in and do a radio button with a value associated with it. But in this particular case, this is a fairly simple, straightforward form. Here. I have to enter in what that sales taxes. So if you had a form it was going to California or one of Washington State Oregon, Oregon would be simple. There would be zero. You could just send it and basically do. That is the form. Would this be great if you're doing with all 50 states? No, this is more for like, an in house form if you're doing local stuff, things like that. But again, this may be one of those things where you can click on a radio button and have a display a certain field or make a certain field active because that's one of those things you could do with a button is you can make a field show or hide a particular field to do that. That would be quite involved. Okay. And we have a question from Beauty of the lake from ST Pete. Would you be able to create a sale sheet slash invoice form with check boxes? That would do calculations, for instance, You check the items the client is purchasing, and then we'll automatically total the items you have checked. Well, I don't know. You'd actually do it. Check. What I would do in this particular case is if we had a list of items here, you could go ahead and say, OK, ordered, you could list out all your items that you have. Um, then go in and put the total number of ordered next to it there. So I don't know that I'd like need a check box there. But I'm sure that if you did, then you could make certain form fields active because one of the things we have when we have the ability to do this is if somebody goes in and does like a button of some sort, then we could go in if they checked it with that button. One of the things we could dio under the action here is shore hide form fields. So if they checked on something with this button which we could make it look just like a check box, it wouldn't necessarily be a check box. But I could then have an entire series of fields become active right there. So this would be a button. But you could make a button look like a check box or something like that, where you click on it and it has a little daughter or something in there when you check it, then I can show an entire row of fields which would then calculate So in that way, yes, you can not super easy to do, but yes, you certainly could. Okay, I think very smart. Pay a question from White Photo. When you tap through a form, will it skip over the fields that are read only? Well, let's try that. Because if we go in and set this to be read only we go through, let's take our right there. We'll show our tab order right there. There's your tab numbers and there it ISS. And the answer is no. It won't because there's our tab order. So it recognises this even though it's read only if I come through here and I tab through, it goes through. That's Tab, that's that tab that one, that one. That one. That 10 it does. It will skip over it, interestingly enough, even though in the tab order it shows you that's part of the tab order. If it's read, only it ignores it. So yeah, it does. It's interesting because it actually gives you the number for the tab order. But read only skips you right over it. Um, we've a question from Robin. If you export for reader can, will a hidden field be changed? Or can it be changed even if that user has pro? Um, it can be, But you have to then save a copy of it because it comes up with their because you can't edit that and you should be able to once you save a copy of it, be able to get to that hit a button. And that's one of the beauties of it is that once you enable it for reader anybody that reader, it's going to work exactly the way you have it functioning. What a great thanks. Okay, definitely more questions about security. Bm photography in the form field Be a security password or can the whole document be password protected so those fields can't be altered? Sorry for the first input. It hard to explain. It's the entire document that's going to be security protected right there. The only other thing that we actually have any type of security on is when we are in doing a digital signature here. So if we wanted to sign this invoice of this document here, and we wanted to do our signature right here, this is when it's going to become secure in a particular field. I don't have security on any other fields except for a digital signature field and a digital signature field works like this. If you have a digital signature field and you click on this to sign, what is going to do is it's going to ask you how to go through and use a sign using your digital signature. If you don't have a digital signature, you can set one up very easily and you get this little question mark there on how do I go in and create a digital signature. This brings you up here, Tells you how to work a digital signature right here. This is actually set up so you can create a signature from your laptop right here or your list. You can also go in and create a new identification for a signature. And anybody can do this. It doesn't cost you anything. So you could go in and sign in as and then choose what's are automatically set up or a new identification right there. How do you want to use this? I wanted to use it from untidy. From a file here. A digital I d. On a server. If you're in a large company, you can stored on a server so you can access it anywhere or device connected my computer. I'm just gonna have this as a file, so I could look for my digital signature on here if I don't have one. And I need to create one while I can just go and say, create a new digital signature. And it'll ask you what type of file do you want to create? If you already have one, you can use an existing one. But I'm gonna create one right now, so I'm gonna click next. And so what's my name here? I don't know. Organization, Unit creativelive organization aim CREATIVELIVE email address everything else. There it is. And I'm going to use the digital I d for digital signatures and encryption. It's gonna ask me where I want to save this too. So it's gonna be saved there. So I'm going to go in and type in my password, confirm my password, make sure it's the same and I click. OK, there it is. When I come to a place where I needed digitally sign something If I don't have an I d, you can create one, which I just did. Once I create that, I click on the digital signature field and will say, signed the document. And if I have multiple users on the one machine, I can navigate toward where that is or if I'm in a company where all the digital ideas they're stored on one server, I go to mine. I choose that I type in the password here if I can remember it right, And I do that there is the password. This is what is going to look like right here. And I can't sign this until I type in the password. And it's not my signature here. It's my digital signature, Okay? It's password protected. It does not have my cursive handwriting. There I click sign, and then I end up saving this to the desktop so that it signed right here. And I do that. And there it is. It was signed with my digital name. Everything else. That's how it is. And it also tells me at the top that all the signatures are valid because it can validate it. Everything else is good. There we have it. So that's the Onley type of security we have in the foreign fields. There is the digital signature field right there. Okay, we have follow up. Question on Did digital signatures Whitney from South Dakota. If we have a tablet to sign using your real signature with this work like you were, take talking last night with saving the image. Or do you know if there's a way to sign with your bamboo tablet on the actual pdf, for example? If so, which would you think is better typed out or sign? Or does it really matter? Well, you if you if you wanted to physically go in and right on something. What you could do is you can go to your commenting and you could just go in and grab drawing and markup tools here and use your pencil and go in and, you know, sign your day as a comment you can delete. It just is easily, um, which is fine. But, I mean, it's not secure it all the other way that I showed you yesterday was going in under the pages panel or the content panel. They're using the at an object and clicking on these items here and going in and doing this. And why am I not able to This is what happens now. I don't want to select all here because it could be a digitally signed vile that I can't change. I can't change this file once I digitally signed it. So let me go back in and open up the invoice here. There we go. Then I could go into my tools, my object, right click on it, and I could place an image of my signature or, in this case, the new Treasury Secretary signature here choose what file that I want to use and then use this file right here and place it as a graphic in there. Is it secure? No, it's just a image. Anybody can grab it right out of there and place in anything else. But what do you signing, you know?

Class Materials

bonus material with purchase

Acrobat Forms.pdf
Acrobat Shortcuts.pdf
Interactive PDFs.pdf
Creating PDFs Cheat Sheet.pdf
Day 1 Course Files.zip

Ratings and Reviews

a Creativelive Student
 

Great class. Was working on a project which included building a company folder that will be spread digitally. Also built some forms along the way. The teachings from Mr. Hoppe helped me a lot. A big thank you to the Creativelive team.

Student Work

RELATED ARTICLES

RELATED ARTICLES