- Published on
ChatGPT Create a free PDF editor. I didn't think I could change the file. I did it.
- Authors

- Name
- aimode.news
- @aimode_news
I have ChatGPT create a free PDF editor because I did not trust that he would change my files – it worked! The smartest way to use AI is perhaps not to let them touch your files, but to ask them to write software that processes them safely – at the time you need to prepare dinner. A Python- command line script solved the PDF problem. Sometimes AI is best suited to writing the tool. Recently, my wife Denise began singing in the choir of her church. She has a nice voice. She had to practice all new songs. The songs came in books, about as large as a commercially available pocketbook, printed on yellow paper. She wanted to scan these brochures as PDF in her computer, remove the color and print them larger on paper in the 8.5 x 11 inch format so that she did not have to wear reading glasses for reading. One afternoon she came to me. She asked how she could remove the yellow background and at the same time get the music herself, so that she could print it without wasting large amounts of color printer ink. If she would print it in black and white, she would still consume a lot of ink to print a gray background that would be even harder to see. She also planned to feed the music in PlayScore 2, an app that plays the notes so that you can sing them. She feared that the background color of the software could not please. I initially proposed removing the yellow background in Photoshop, but the procedure proved too cumbersome. Different slider settings were required for each image. It was just too annoying and time-consuming to make it that way. So I suggested to her, chatGPT to use. She has a ChatGPT Plus account, so this seemed to be a fair option. Deterministic vs. nondeterministic
I have performed some tests and used prompts like:
Give me back a PDF I can download where the yellow background was removed and replaced by white. You did it right, but unfortunately the quality of the text is very low. Can you please regenerate it in full resolution? These tests have worked, but ChatGPT has subtlely changed the resulting PDFs. My wife feared that ChatGPT could change the notes, text or other aspect of original music. She didn't want to read the sheet and practice it wrong. ChatGPT and other AIs are “not deterministic”. Webster defines determinism as “events in nature or social or psychological phenomena that are causally determined by previous events or natural laws.” In other words, the input always predicts the output. In contrast to AI, algorithmic programming is deeply deterministic. Granted, programs can run out of the row, but they do so in a way that can ultimately be predicted from the exact arrangement of code and variables. AIs are not deterministic. This means that you could enter the exact same input three or four times and retain three or four different results. It's like talking to a plumber or an electrician. AIs are based on a complex range of probability calculations, so that the results can change during each passage. Denise has experienced this in her interactions with ChatGPT. She didn't want to leave ChatGPT to her music and get back something ChatGPT took out liberties against Masters. She wanted a tool to remove background colors that was strictly deterministic. Python can
For my final program in my Harvard-Python programming certification, I wrote an interactive image management tool that was able to perform individual photoshop-like image transformations and merge them into sequences. So I knew Python had the libraries to get what Denise wanted. I didn't have the time to write a Python program. It was a very busy week. However, I had a long residue on work-related projects that I had to drive forward. But ChatGPT has all the time in the world. It'll be cool here. You can use a non-deterministic tool like ChatGPT to generate a deterministic program like a Python discoloration tool. If you want to read a really interesting article about AI determinism vs. non-determinism, read this from former ZDNETer Jason Perlow. In any case, I decided to ask ChatGPT to write a python script that would take the color distance. To create the script, I gave him this request and then went to the kitchen to help my wife prepare dinner. Write a Python script that records a JPEG and puts all pixels that are not gray or black on white and stores it again as name-decolor.jpg, where name is the file name. Allow slightly tinted grey tones so that black text is correctly displayed on a colored background as a black text. Can you do the same when a PDF is displayed? It must also work if the PDF includes several pages. When the dinner was ready, ChatGPT was ready. The first version of the script had some problems as I had to install a Python library. But then it just ran. It just works. You run the decolor pdf.py program over the command line and feed it with a single PDF file. A new PDF file with a remote background color is output. % python decolor pdf.py input.pdf
Does it work? Yeah, it does. If you want to download a copy for yourself, find it in my GitHub-Repo. My wife was concerned about using screenshots from copyrighted church songbooks in this article, so I visited the New York Public Library website and grabbed a non-common song to demonstrate it. This is a song of Fats Waller jazz, who has also written several musicals. It is a somewhat rugged song that uses horse racing metaphors to describe changing lovers. It was written together with Andy Razaf, who is known to write the lyrics about songs like “Ain’t Misbehavin” and “Honeysuckle Rose”. Helpful lessons
So there are some helpful findings from this experience. If you need the help of the AI, you do not always have to rely on non-deterministic processing. Sometimes you can just ask you to write a program based on a reliable algorithm. You don't have to spend much time creating an appearance or user interface. Sometimes it is enough to create a simple command line tool. Do not be afraid to refine your specification with the AI. Try out what this creates and then ask for optimizations and corrections. Python can do a lot. There are many, many libraries. So if you are not sure what you want to use, create it in Python. Let's go. If you need a quick solution for something, ask ChatGPT to write it for you. Has worked with me and I could give my wife a useful tool while helping to hide a chicken.