With version 6.1.1 of Datalogics PDF Java Toolkit, our Engineering team built a whole new set of samples that focus on best practices with PDF and Java. That doesn’t mean that what we were shipping before was wrong or bad, the old samples were more like proof that PDF Java Toolkit functioned as expected. To be honest, with the old samples we found that sometimes the samples didn’t function as we expected!
To help keep us honest with ourselves and, more importantly, with our customers, we have made the GitHub repository that contains our samples, tests, and input files publicly available. Go check it and the samples out and if you spot a problem, let us know by creating an issue! Let’s take a quick look at how to work with the samples.
In my last article I ended on a small tease:
At a lull in between, I took a small break to put together a quick DLE program to demonstrate how one masks an Image with a vector path, which I’ll discuss in a follow-up article.
Since the solution isn’t as exciting as you might think, I’m going to discuss the other ways that you can mask an image before revealing the solution and discussing it, because there are lots of ways to mask an image in PDF, so it’s a bit more interesting a topic than you might think.
Sometimes a picture is worth a thousand words, or so they say. That must mean that a video is worth even more, right?
We launched PDF Alchemist almost a year ago and have been working to refine our explanation of what it does and what it is. We have learned a great deal over the last year from talking with evaluators and customers about PDF Alchemist and today we have uploaded a video to help us explain it. You can find the video on the home page for PDF Alchemist or further on in this post.
Since we have determined that a video is worth more than a picture, take a few minutes to watch the video about PDF Alchemist and then let us know what you think! If you are interested in trying out PDF Alchemist, you can sign up for an evaluation by going to the PDF Alchemist home page and filling out the evaluation form.
Sample of the Week:
Replacing images in a PDF file using the Datalogics PDF Java Toolkit isn’t exactly as easy as replacing a light bulb… but it’s close.
What You Need to Know First:
I’ve kept things simple in this example. There’s only one image in the single page file so we don’t need to go through the effort of identifying it as the one we want to replace; we can just replace it.
An image of the input file is on the left, the output file on the right. You can see that I just zoomed in a bit on the same photo and cropped the image a bit. Because I started with the same image I know that the original and the replacement images are in the same color space, have the same dimensions, and bits per pixel. Keeping these details the same means that all I really need to do to replace the image is replace the stream that represents the image data rather than recreate or update the other dictionary values in the XObject that gets painted by the viewer.