Automatically integrate CS-Scripts with PDF conversion
Karina Schulz Wharwood, Categories:BlogIf you’ve ever wished you could make PDFCreator do just a little more, then the CS-Script action might be exactly what you’ve been looking for. It can rename files automatically, send documents straight to another application, or validate metadata before saving.
This advanced PDFCreator feature, available exclusively in our Business editions, lets you insert small C# scripts into your conversion process. This allows you to fully customize what happens before or after a PDF document is created. Make your daily print and conversion work faster and more efficient.
What is the CS-Script?
Another way to think of the CS-Script action is as a bridge between PDFCreator and your own business logic. Instead of manually running extra steps after conversion, you can automate them directly inside your workflow.
You decide when your script runs:
- Before conversion: to check file properties or adjust metadata
- After conversion: to rename, move, or upload the finished PDF document
Automating secure PDF generation with C# to streamline document workflows
When to use it
Here are a few ways businesses use the CS-Script action every day:
- Quality checks: Cancel or tag print jobs that don’t meet naming rules or metadata standards.
- Automatic uploads: Push completed PDFs to a DMS, cloud folder, or internal API.
- Custom logging: Keep detailed conversion records for audits or billing.
- Post-processing: Apply compression, password protection, or further editing tools automatically.
Essentially, if you’ve ever thought “I wish PDFCreator could do X when a job finishes”, you can probably achieve it with CS-Script.
How CS-Script works
Once you enable the action in the profile settings, PDFCreator looks for your script file (usually in the “CS-Scripts” folder).
When a job starts, PDFCreator:
- Loads and compiles your script.
- Hands it the current print job’s details.
- Executes your pre- and post-conversion methods.
You can then access properties like filenames, output paths, tokens, and metadata, allowing your code to modify, validate, or trigger additional steps.
Ready to take document workflow automation to the next level?
Try PDF Creator’s CS-Script feature today streamline your workflow in one click.
Use case
Here’s a minimal template showing how a script might look:
using System;
using NLog;
using pdfforge.CustomScriptAction;
using pdfforge.PDFCreator.Conversion.Jobs.Jobs;
public class MyScript : IPDFCreatorScript
{
public ScriptResult PreConversion(Job job, Logger logger)
{
job.JobInfo.Metadata.Author = "Marketing";
return ScriptResult.Success;
}
public ScriptResult PostConversion(Job job, Logger logger)
{
logger.Info("Files created: " + string.Join(Environment.NewLine, job.OutputFiles));
return ScriptResult.Success;
}
}
In this example, the script adds a default author before conversion and logs the output path afterward.
Why you should use C# to convert PDFs
The CS-Script action is one of PDFCreator’s most flexible tools. It saves hours of manual post-processing, integrates easily into existing systems, and scales perfectly for automated workflows.
If you’re using one of PDFCreator’s Business editions, we strongly suggest you give it a try. Open your profile settings, enable CS-Script, and see how much smarter your PDF workflows can become.
How to integrate your CS-Scripts before and after a PDF conversion
The CS-Script action can be enabled in the advanced section of the queue settings. Your script file must be located in the CS-Scripts folder and has to be a .cs or .csx file. To automatically integrate them as part of the workflow (action) feature in PDFCreator, here is what you need to do:
- Open PDFCreator
- Go to the "Profiles" tab to select the "Automatic saving mode"
- Click on “Add action” and select “CS-Script”
- Select and check your CS-Script and click on “OK”
Now your CS-Scripts will automatically be integrated in the workflow when converting your print jobs.
Frequently asked questions about CS-Script
What is the best practice for organizing scripts in a common folder for a PDF project?
Check the sample script included with PDFCreator and visit the official user guide.
What are the common use cases for scripting in PDF conversion applications?
- Rename or move PDFs after conversion.
- Log job details or validate files before saving.
- Automate repetitive post-processing steps.
How can you link PDF files to scripts for enhanced reading experiences?
Place your .cs or .csx file in the CS-Scripts folder. Once selected and enabled in the PDFCreator’s CS-Script action, the script automatically runs during each print job to modify or enhance your PDF worklfow.
What programming language is primarily used in PDF CS-Script for scripting actions?
C# (C-Sharp). CS-Script runs standard C# code inside PDFCreator, using the .NET Framework.
How will the execution of a PDF-based script differ from traditional print jobs?
A normal job simply converts your document. With CS-Script, PDFCreator executes custom code before and/or after the conversion, letting you adjust settings, add actions, or automate tasks.
What is the best practice for organizing scripts in a common folder for a PDF project?
Store all your scripts in the default CS-Scripts folder. Name them clearly (e.g., RenameFile_PreConversion.cs) so they’re easy to identify and maintain.
What are the common What are the benefits of using PDFCreator in conjunction with PDF CS-Script?use cases for scripting in PDF conversion applications?
You can automate and customize every job, add advanced logic to conversions, and integrate PDFCreator with other systems, all from one application.
How can you enhance user interaction within PDFs created using CS-Script?
You can also insert custom data fields or personalize files automatically.
Other articles you might enjoy