AI in Action: Developing a Win2PDF Plug-In as a Practical Case Study

In our previous blog post, we explored how effective prompts can be used to create Win2PDF Plug-Ins with AI chatbots. Today, let’s examine a specific customer solution we developed.

Customer Requirement: Every time a Technical Bulletin is saved as a PDF, the customer needs the first page—containing a summary description—saved as a JPG image. This allows them to display the summary image on their website, linking it to the full PDF bulletin for download.

Solution: There are multiple ways to automate this process. One efficient method involved creating a Win2PDF Plug-In with minimal effort using Microsoft Copilot. Here’s how we achieved it.

1. Use AI to generate a Powershell program for the Plug-In

In our example, we’re using Microsoft Copilot but you can try using any AI chatbot.

For the first prompt, copy ALL of the documentation text for the Win2PDF PDF to JPG Command Line and paste it into the chatbot.

Copilot acknowledges the input of reference documentation and asks if we have a specific task using this information. Since we do, we’ll enter our prompt for the customer requirement, including the programming language, the Win2PDF command required for the Plug-In, and the desired JPG resolution.

Write a Win2PDF plug-in in Powershell that takes a single parameter with an input PDF and uses the Win2PDF command line option “PDF2JPG”. The plug-in should save the first page of the PDF as a JPG image with 200 DPI resolution.

Here are the results returned by Copilot:

We’ll then save this Powershell code as a text file located somewhere on the hard drive where it is accessible, such as:

c:\users\test_ai\SaveFirstPageAsJPG.ps1

There was one small edit required, which was for the path for the Win2PDF Desktop program ($Win2PDFPath). Since we’re using a 64-bit bit version of Windows, the Win2PDF Desktop program on my PC is located here:

C:\windows\system32\spool\drivers\x64\3\

In this example, we used PowerShell because it’s easy to use and doesn’t require compilation. Alternatively, you can adapt your prompt to use C#, VB.NET, or any other programming language if you prefer a different approach.

2. Change the default execution policy on your PC.

Since our Plug-In is a Powershell script, we’ll need to change the default execution policy on our PC to allow scripts to run.

  • Start Windows PowerShell with the “Run as Administrator” option. Only members of the Administrators group on the computer can change the execution policy.
  • Enable running unsigned scripts by entering the following and choosing [A] Yes to All:

set-executionpolicy remotesigned

This will allow running unsigned scripts on your local computer and signed scripts from the Internet. This will change the policy permanently.

We can test our script by opening a command prompt and typing

powershell -F c:\users\tmp\SaveFirstPageAsJPG.ps1 c:\testTechBulletin.pdf

3. Use the Win2PDF Administrator Utility to use this program when creating a PDF file.

Finally, download and install the free Win2PDF Administrator Utility.

To use this as a Plug-In, open the Win2PDF Administrator Utility and enter the following command under “Run this program after PDF creation (optional)” on the File Name tab:

powershell -F c:\users\tmp\SaveFirstPageAsJPG.ps1

Then click the “Apply” button to save this command a Plug-In. [Note: The Win2PDF Administrator Utility will automatically add a “%s” argument to the end of the command when saved, so Win2PDF will automatically pass the PDF file name to the Plug-In.]

If you’re not familiar with Powershell programming, check out Microsoft’s online documentation for assistance or better yet, ask your AI chatbot for help.

4. Test the Results

Create a new technical bulletin and print it using the Win2PDF TechBulletin printer. Once complete, confirm that both the PDF file and a JPG copy of the first page are saved in the same location.

This simple example demonstrates how quickly and easily you can automate a workflow when an out-of-the-box solution isn’t available. You could expand this process further—for instance, by resizing the JPG or moving it to another folder—but this provides a clear idea of the steps to create your own Plug-In.

If you get stuck, don’t worry. Just ask and we’ll help.

Vibe Coding: Crafting Effective AI Prompts for Custom Win2PDF Plug-ins

Vibe coding is a novel approach to software development that leverages artificial intelligence (AI) to generate code based on desired functionality or “vibe.” It allows developers to express their intentions in a more abstract and intuitive way, rather than writing explicit, line-by-line instructions. This methodology is particularly useful for creating Win2PDF Plug-Ins, enabling faster development and innovative solutions for specific customer applications.

Vibe coding utilizes AI models trained on vast amounts of code and natural language. Developers provide high-level descriptions of what they want the Plug-In to achieve, and the AI interprets these descriptions to generate the corresponding code. Since Win2PDF has extensive online documentation with syntax descriptions and code examples, most AI programs can already generate Win2PDF Plug-Ins.

And while creating a custom Win2PDF Plug-In with the help of AI can be powerful, its success relies heavily on the quality and specificity of your prompts. We’ve been experimenting with a variety of different AI chatbots to see how they can handle generating code for Win2PDF Plug-Ins, and the results can vary widely depending on how the prompts are structured. We’ve tried this with Google Gemini, Microsoft Copilot, OpenAI ChatGPT, GitHub Copilot, Anthropic Claude, and others.

Chatbots can create Win2PDF Plug-Ins

Based on our experience, here are some tips to help you write successful AI prompts.

Be Specific and Detailed

The more details you provide, the better the AI can understand your requirements. Avoid vague statements and instead, describe exactly what you want the Plug-In to do. For example:

Instead of: “Make a Win2PDF Plug-In for PDF watermarks.

Try: “Create a Win2PDF Plug-In in C# that adds a custom watermark file to all pages of a PDF document except for the first page. Name the new file with the same name as the input file, but add “_watermarked” to the file name.

Break Down Complex Tasks

If your Plug-In needs to perform multiple functions, break them down into separate prompts. This makes it easier for the AI to understand each part and generate the corresponding code. For example:

Instead of: “Write a PDF Plug-In to extract pages in different files with watermarks.

Try:

  • “Write a Win2PDF Plug-In in C# to export pages 2-4 and 5-6 in separate files and add a watermark to both. “
  • “Use the Win2PDF command line “extractpages” and Win2PDF command line “watermark” commands.”
  • “The watermark should use the existing “confidential.pdf” file as the watermark.”

Specify the Programming Language

If you have a preference for a specific programming language (e.g., VB.NET, C#, Powershell), mention it in your prompt. This will help the AI generate code that is compatible with your existing setup.

Example: “Generate a program using C# that extracts text from the last page of the PDF and saves it to a text file using Win2PDF.

Provide Context and Examples

Give the AI context about the existing Win2PDF environment and provide examples of the desired output. This can help the AI understand your needs better.

Example: “Write a Powershell program that will save the first page of a PDF file as a JPG image with a user-definable resolution. It should use the following command syntax: “win2pdfd.exe pdf2jpg “sourcepdf” “destjpg” pagenumber xresolution yresolution”, where the xresolution and yresolution are set to be 200. The output JPG files should be the same name as the input file name, but with a “_page1.jpg” added to the input file name.

Iterate and Refine

Don’t expect perfect results from the first prompt. Review the generated code and provide feedback to the AI. You may need to refine your prompts and ask for modifications several times to achieve the desired outcome.

Example: “The generated code is close, but the encryption is not using AES-256. Please modify the code to use AES-256 encryption instead of the current algorithm.

Also, to improve results, tailor your prompts for the AI you are working with. For Github Copilot, for example, browse to the Win2PDF.Samples repository before asking it to generate a Plug-In. Github Copilot will use the Win2PDF.Samples repository to produce better code that is more likely to work as expected.

If a generated Plug-In doesn’t work, try copying the Win2PDF documentation into the prompt and ask it again. For example:

Instead of: “Write a Win2PDF Plug-In in Windows Powershell that takes a single parameter with an input PDF and exports pages 2-4 and 5-6 in separate files and adds a watermark to both.”

Try: “Write a Win2PDF Plug-In in Windows Powershell that takes a single parameter with an input PDF and exports pages 2-4 and 5-6 in separate files and adds a watermark to both. The new files should be placed in the same folder as the source file. Use the Win2PDF command line win2pdfd.exe “extractpages” and Win2PDF command line “watermark” commands . The watermark should use the existing “confidential.pdf” file as the watermark. The documentation for the watermark command is: win2pdfd.exe watermark “sourcefile” “watermarkfile” “destfile” mode excludepre excludepost Where: “mode” is either “watermark”, “background”, “watermarklink”, or “backgroundlink” If mode is “watermark” or ““watermarklink”, the watermarkfile PDF is overlaid on top of all existing graphics on the page. If mode is “background” or “backgroundlink”, the watermarkfile PDF is placed underneath all existing graphics on the page. If the watermark file has click-able links, you can use the “watermarklink” or “backgroundlink” variation to keep these links active in the final PDF file. “excludepre” is the number of pages from the beginning of the document to skip applying the watermark. Set to 0 apply watermarkfile to all pages including the first page. Set to a negative value to include the watermark to the absolute value of the number of pages from the beginning of the document. “excludepost” is the number of pages from the end of the document to skip applying the watermark. Set to 0 to apply the watermarkfile to all pages including the last page. Set to a negative value to include the watermark to the absolute value of the number of pages from the end of the document. The documentation for the “extractpages” command is: win2pdfd.exe extractpages “sourcefile” startpage endpage “destfile” Extract pages from “sourcefile” starting at “startpage” to “endpage”, and save extracted pages in “destfile”. Any file names that contain spaces must be enclosed with quotation marks. The “sourcefile” can be a local file path, or an web address (URL) to an existing PDF. Returns 0 on success, and a Windows system error code on failure. If “sourcefile” and “destfile” are the same file, the file is modified in place. Any file names that contain spaces must be enclosed with quotation marks. The “sourcefile” can be a local file path, or an web address (URL) to an existing PDF. Returns 0 on success, and a Windows system error code on failure.”

While that looks complicated, it’s essentially the same prompt WITH copied documentation on how to use each of the commands we know the Plug-In will need to use, and the steps the Plug-In will need to perform. AI will understand this better than you or I, and the results are much improved.

Test Thoroughly

Always test the generated Plug-In thoroughly to ensure it works as expected. Pay attention to error handling and edge cases. Using AI to generate code is still not fool-proof, and in our experiments the code results frequently need to be tweaked to make them work as desired. Over time and with the rate of AI advancement, we expect this to be less of a problem in the future.

By following these tips, you can effectively communicate your needs to the AI and create custom Win2PDF Plug-Ins that meet your specific requirements.

If AI can’t get you the results you need, contact us with your specific requests and customizations for Win2PDF.

Win2PDF Now Supports PDF Direct Printing

What is PDF Direct printing?

PDF Direct is a feature available on many printers that allows PDF files to be sent straight to the printer without being processed through any software first. There may be slightly different names used by each printer company, but it’s typically referred to as PDF Direct Print or Direct PDF printing.

This feature is useful because it is a much faster way for printers to print PDF files since there is no intermediate conversion process needed by software.

Most business class printers from HP, OKI, Kyocera, Ricoh, Canon, and Xerox support PDF Direct printing, but most consumer inkjet printers do not support it. Look up your printer’s documentation for the specific model to see if it supports PDF Direct printing or not. If you aren’t sure, it’s safer to use the Win2PDF Print PDF command line. This is slower but will work for all printers.

One important caveat: If you attempt to use this feature on a paper printer that does not support PDF Direct printing, many pages of garbled text will be printed instead of the PDF.

This feature is available in the Win2PDF 10.0.142 version or higher, and it is a free update to all Win2PDF 10 users.

There are 2 ways to use the latest Win2PDF software to print PDF files directly.

  1. Use the command line option for Win2PDF PDF Print Direct [link goes to documentation for this feature].

This is probably most useful for larger organizations that are batching many PDF files to the printers, perhaps along with other Win2PDF command line options.

  1. Use the new Win2PDF Direct Print Plug-In [link goes to download page for plug-in].

This is probably most useful for users interactively generating PDF files.

When you install the plug-in setup, you will be prompted to select a PDF Direct Printer.

After this is selected and saved, a copy of each printed Win2PDF PDF file will be sent automatically to this PDF Direct Printer until disabled. To disable this feature, you can remove the Win2PDF Direct Print Plug-In using the Windows control panel.

This feature may not be useful to all PDF users, but for organizations that are processing large volumes of PDF files it can dramatically reduce the time needed for printing.

When we presented this for testing to a customer who wanted this feature, he replied:

There is no question why I highly recommend Win2PDF to all my clients and will continue to do so! Unbelievable service for an outstanding product!

Brian H., Hawaii

Win2PDF “Watch Folder” Feature Continuously Monitors and Converts Files

The latest Win2PDF automation tool is the new Watch Folder* feature. This feature allows you to select a local or shared folder to monitor or “watch”. Whenever a supported file type is added to this folder it will automatically be converted to an output file in a different format.

If the watch folder is a shared network folder, multiple users can convert files by copying files into the shared watch folder.

Note: This feature is only available in the Win2PDF Pro Terminal Server Edition (TSE) version.

For example, suppose you have fax software that allows you to save incoming faxes as .TIFF files. And what if you’d like to take all of your faxed image files and convert them into searchable PDF file

In this case, you’d simply set up a Watch Folder where you’d save your faxed .TIFF files, and whenever a .TIFF file appears in this folder it is automatically converted to a searchable PDF file.

There are two primary ways of setting up the Watch Folder.

The first way of starting the Watch Folder is through the Win2PDF Desktop App. When you start the Win2PDF Desktop App, a new menu named “Watch Folder and Convert…” appears in the File menu. (You can also launch this directly by running “Win2PDF Watch Folder and Convert” from the Windows start menu.)

When Watch Folder and Convert… is selected, you’ll be able to select the folder to watch, the folder to save your output files to, and an option to either move or delete the original files. You’ll also be able to choose the format of the converted files.

When the Watch button is selected, the Watch Folder actively monitors this folder for any new files that get added. You’ll know it’s active because the interface will be ‘grayed out’ and a ‘Watching…” indicator appears. If any files are added to the watch folder, they are automatically converted

You can turn off the Folder Watch feature by simply clicking on the Stop button.

The second way iis to open a command prompt and start the watch folder through the following command line.

win2pdfd.exe watchconvert "watchfolder" "completedfolder" "convertedfolder" destformat

This watches the folder specified by “watchfolder” and automatically converts all compatible files to the specified format, and saves the converted files using the same base filename to “convertedfolder“. Upon successful conversion, the source file is moved from the “watchfolder” to the folder specified by “completedfolder“. If the “completedfolder” is empty (“”), the source file is deleted after conversion.

Compatible file formats in the “watchfolder” can have the following file extensions:The “destformat” can be one of the following file types:
.PDF
.HTML
.HTM
.XPS
.TIF
.TIFF
.JPG
.JPEG
.JPE
.PNG
.BMP
.DIB
.GIF

(other file types will be ignored)
pdf
pdfimagemono
pdfimagegrayscale
pdfimagecolor
pdfcompressed
pdfsearchable
textformatted
textunformatted
jpggray
jpg
tiffmono
tiffgray
tiff
pnggray
png
ocrtextformatted
ocrtextunformatted

To stop the folder watching, simply enter CTRL-C in the command prompt window and it will stop watching the folder.

As noted earlier, this feature is only available in the Win2PDF Pro Terminal Server Edition (TSE) version of Win2PDF. If you want to try this feature, you can request a 30-day evaluation license.

Any questions or feedback? Let us know at [email protected].

Win2PDF Not Affected by Log4j Remote Code Execution Vulnerability

Just a quick note since we’ve received several questions about the recent Log4j exploit and the alarm its causing in IT departments around the world.

Question:

The Apache Software Foundation has released a security advisory to address a remote code execution vulnerability (CVE-2021-44228) affecting Log4j versions 2.0-beta9 to 2.14.1.

A remote attacker could exploit this vulnerability to take control of an affected system. Log4j is an open-source, Java-based logging utility widely used by enterprise applications and cloud services.

Does win2PDF use this software? 

Answer:

No. Win2PDF does not use Java or Log4j.

Win2PDF is not vulnerable to CVE-2021-44228.

Get Into Your PDF Flow using Microsoft’s Power Automate Desktop Software

Soooo many requests:

“I wish there was an easy way to convert all of these text files to PDF automatically.”

“Why can’t I just save an entire series of web pages as searchable PDF files?”

“How can I consolidate weekly reports from different applications and formats to a single PDF file without spending my whole afternoon doing so?”

These and other questions arrive in our email inbox daily. It seems everybody has some level of repetitive PDF processing that they do and are looking for an easier way to get it done. And since many of these issues are specific to a particular application or to your own business process, it’s not easy to find a one-size-fits-all solution that gives you the type of “push button” solution you really want.

That’s one reason why we’ve been so focused on creating tools like Win2PDF Auto-name, Win2PDF command-line processing, Win2PDF Plug-ins, and Win2PDF mail integrations. All of these features give powerful automation control to the user to eliminate repetitive steps and reduce processing errors.

Now, there’s something that combines all of these Win2PDF “tools” into a single problem-solving toolkit that works with all of your files and other applications. And best yet, it won’t cost you a penny!

Microsoft’s new Power Automate Desktop software is a free download for Windows 10 users that allows you to easily automate any repetitive tasks from your desktop, including the creation or manipulation of PDF files using Win2PDF. Once installed, you just need to create a desktop flow (the series of steps that automate a specific action or task). And no, you don’t need to be a coder to use it. Microsoft has a simple interface that most anyone can use.

It’s quite easy to build your first desktop flow using either pre-built drag-and-drop actions or by recording your own desktop flows to run later. For this latter method, it works similar to macros in Microsoft Office, by recording repetitive actions from your desktop across multiple applications—like your web browser, Microsoft Excel, Microsoft Outlook, Win2PDF, etc.—and then lets you replay the automation whenever needed.

For example, a quick desktop flow to convert all TXT files in a folder to PDF using Win2PDF (using the Win2PDF Auto-name feature) might look something like this:

A very simple recipe like this could save you a lot of time if you are currently working with PDF files regularly and in the same manner.

We’ll be diving into this topic in a bit more detail in future posts, including some more detailed examples where this might be useful. In the meantime, get into the flow and download the Power Automate Desktop software today and look at the Win2PDF Power Automate documentation to see what it can do for you.

Win2PDF Plug-Ins Extend Features Specific to Customers’ Needs

Last month we introduced a new Win2PDF Plug-In for Slack, and this month we’re back with several new Win2PDF Plug-Ins.

A Win2PDF Plug-In is simply a small customizable program that can be created, modified, or installed that will give the user an option to automatically take some action with the PDF file after it has been created. It allows Win2PDF’s functionality to be extended to address specific customer needs or workflow integrations. For example, it has already been used by customers to upload PDF files to a content management system, automatically make archival copies of PDFs, store PDF in cloud-based services, delete blank pages, split PDF files into single page documents, use multiple watermarks, and send a PDF file to a specific email program.

Why use Plug-Ins? Why not just add these features directly to Win2PDF?

The Win2PDF Plug-Ins were created specifically to add capabilities that might be unique to each customer. Most of the new Plug-Ins were unique or very specific to a customer request, so they may not be useful to the user base at large. Rather than clutter the main Win2PDF program with these types of unique features, we allow them to be created, customized and added as needed for each customer.

As of today, there are 8 additional Plug-Ins available for download at our GitHub page. [GitHub is a central code repository for our Plug-In samples — you can download compiled Plug-Ins that are ready to use, or, if you are a developer, you can download and modify the source code to build your own Plug-Ins specific to your needs. These examples show what can be done with Win2PDF, and provide a template for future solutions.]

The new Plug-Ins are:

  • PDF Send To Outlook – Add a “Send To Outlook” option to Win2PDF File Save window to automatically attach a PDF to an Outlook email message.
  • PDF Duplicate File – Automatically make a duplicate copy of the newly created PDF file in a designated duplicate file folder which may reside on a shared network location or in a cloud based folder (OneDrive, DropBox, Google Drive).
  • PDF Print Logger – Automatically log files created by Win2PDF to the Windows Event Log.
  • PDF Archive File – Automatically archive newly created PDF files created by Win2PDF in a designated archive file folder which may reside on a shared network location or in a cloud based folder (OneDrive, DropBox, Google Drive). Files are appended to an archive PDF named based on the current date.
  • PDF Delete Pages – Automatically deletes extra pages from a newly created PDF.
  • PDF Split Pages – Automatically splits a multi-page PDF into separate one page PDFs.
  • PDF Apply Multiple Watermarks – Automatically apply different watermarks to separate sections of a PDF [Requires Win2PDF Pro].
  • PDF Image Only Flattener – Automatically merge watermark layers into a single layer Image Only PDF [Requires Win2PDF Pro].

A few other notes:

  • The samples only allow one Win2PDF Plug-In used for each instance of the Win2PDF printer.
  • If you wish to remove a particular Win2PDF Plug-In, you can use the Windows Add/Remove Programs feature to uninstall.
  • All of the Win2PDF Plug-Ins hosted on this page can be used at no charge. Some only work with licensed versions of Win2PDF. Contact [email protected] for a 30 day evaluation license.
  • An evaluation version of Win2PDF can be downloaded for free at https://www.win2pdf.com/download/

If you have any requests for Plug-Ins, let us know. We’re interested in building out this capability with more examples, so if you have a particular integration or special need, send an email to [email protected] and tell us about your requirements. If it’s something we can assist with, we’ll be happy to help.

For now, hop over to the Win2PDF Plug-Ins page and take a look.

Content-based File Naming with Win2PDF

*** NEW FEATURE ALERT ***

In our latest Win2PDF 10.0.58 update we added a new feature for content-based file naming. It allows a PDF file to be named based on a certain word or set of characters that reside inside of the document being printed.

Here is the customer situation that prompted the new feature:

A county sheriff’s department wanted to generate PDF files from a legacy AS/400 application. A secretary named the PDF files based on a document number that was listed in the original document, and because she did so manually it was time-consuming and error-prone.

An example transport order from the sheriff’s department looked like this:

sheriff1

With the content-based file naming feature in Win2PDF, however, this process is automated. It allows Win2PDF to search the text of a document being printed, find a target search word, and use the following word as the PDF file name. It requires that PDF files contain text with a common search word that exists in all PDF files. (*Note: The “word” can be numbers or any character string that has a space before and after the “word”).

In the sheriff’s example, the content search word is specified as “DOC #:” in the Win2PDF Admin Utility.

sheriff2

Then, in the Document section of the Win2PDF file save options, the “User Defined” field was enabled with “%PDFAutoNameContentSearch%.pdf” as the file name.

win2pdf-auto-name-content-based-naming

The result? When each file is printed, Win2PDF searches for the document number in the original file, and then automatically names the PDF file with this number. No possibility of manual errors or extra time involved.  In this case, the file was automatically named “118277.pdf” when the file was printed.

Again, this was a relatively simple modification that we were able to do for customer that had a particular need and had no ability to change the original AS/400 program printing the documents.

If you have a similar need, let us know and we may be able to help.

Win2PDF for the Enterprise: Integration

In our last post, we talked about how Win2PDF can be customized for the enterprise.  In this post, we’ll continue the theme of enterprise users but focus on how Win2PDF can be integrated with other applications or business processes.

img_488306First, all of the Win2PDF products make use of the standard Windows API for printers. This means other applications can print to Win2PDF automatically, without any user interaction.  It does require some level of technical proficiency in programming, but there are a variety of programming environments we have documentation for, including Visual Basic (VB), Visual C for Crystal Reports, .NET, and Microsoft Access.  For a broader perspective all all features, just visit the Developer Information section of the Win2PDF user guide.

This in and of itself is a powerful tool that allows enterprises to create PDF files with specific naming conventions, file locations, and output options automatically.

Other useful features for incorporating Win2PDF with enterprise processes are:

  • Post-action setting:  This is a registry setting that can be set to allow the PDF created by Win2PDF to be passed to another program.  This can be useful for doing a secondary step with the PDF file, like processing it into a document management, email, printing, or reporting application.
  • Command-Line interface:  This was something we recently added and dedicated a blog post to it earlier this year.  It supports simple command line access to Win2PDF for merging, compressing, extracting pages, encrypting, and a variety of other PDF functions.
  • Win2PDF Mail Helper:  This free utility provides a SMTP mail client that can be used to send PDF files via email without user interaction.

Basically, if you have the ability to modify the application you are using to generate PDF files, using the integration options described here will give you the most powerful and flexible options to link PDF files into your workflow processes.  If you do not have the ability to modify the application, then the customization options for the enterprise would be the best option.

Let us know if you have questions about these or any other integration issues.  Again, if you can think of a situation where your PDF files can be incorporated into an enterprise process, there’s a good chance we’ve already figured out a way to make it happen.