Hi,
I looked at your code. The solution James gave is the one I used when I first started. Keep it simple. Create a image to print in landscape mode and another in portrait mode. Use these images that also contain your logo and other non-text objects.
In your case, create a jpg image with your favorite editing program which has the ratio of width to height of 1.415 (maybe 1754 by 1240 pixels) for an A4 . This is the image size for a certificate in landscape mode. Add a border, logo, signature or other things to this image. Print it to make sure it looks right on a piece of paper.
I replaced Fancy1-brown.jpg border with my new one. I changed the other lines of the code for a landscape certificate to re-position my text and text strings.
I used the same process for an image that would be printed in portrait mode. The A4 portrait ratio of width to height is .707 (maybe 1240 by 1754 pixels). I replaced Fancy2-brown.jpg. I changed the other lines of the code for a portrait certificate.
I told my teachers which border images to use.
I like this simple WYSIWYG approach for the two different printing orientations. The way I see my special boarder images is the way they will print.
Once this worked, I took the next step. I figured out how my teachers could see "Collman1-purple" as a choice along with "Fancy1-brown". You did not ask how to do that
Hope this helps. Images are always tricky in HTML or in code like this.
Chris