Recent Posts

Pages: 1 ... 8 9 [10]
91
General / Re: barcode import list
« Last post by RTT on October 03, 2021, 02:00:48 PM »
1. if I want to align the barcode right top it seems not positioned correctly. I have attached an example image
Uncheck the "Fit to page" option. That option is accessible from the above design area toolbar, menu icon button. You seem to be using an older version, than the current 3.4, that has that option in the "Files" tab, stamp mode options group.
Quote
2. which is the unit measurement for the size of the barcode, width and height ? I use millimeters
It uses the points unit.
1 inch = 72 points
1 inch = 25.4 mm
1 point = 0.352777778 mm

So, to convert the value in mm, divide it by 0.352777778 and type the result in the tool.
92
General / Re: barcode import list
« Last post by Nick Riviera on October 01, 2021, 08:50:38 AM »
Hi,

I have some questions..
The barcodes are generated very quickly but,

1. if I want to align the barcode right top it seems not positioned correctly. I have attached an example image
2. which is the unit measurement for the size of the barcode, width and height ? I use millimeters
Thank you



93
General / Re: Using with python - truncated help
« Last post by RTT on August 26, 2021, 08:33:38 PM »
I'm taking a stab at writing a python wrapper for PDF-ShellTools, and I'm wondering if anyone else at the forum has any experience with this. Specifically, I'm running PDFShellTools.exe with the subprocess package. This will suffice to let me work out the logic of what I'm trying to build, though I'd love to hear if anyone has used the dll from python. Heck, which dll?
Can't help you with the python language, but it's the pdfshelltools.dll that exports the tool functions. These exports are the same used by the command line interface tool pdfshelltools.exe.
The exported functions use the same prototype as the functions that can be run by the rundll32.exe Windows tool. It is explained in the user's guide DLL interface topic.
Take note you must use a 32-bit version of Python, to use the DLL interface, as the pdfshelltools.dll is 32-bit.

Quote
First things first, I've hit a snag trying to capture the help message. When I don't capture the output, the full message is displayed in the Windows command line terminal. However, trying to capture the output to stdout only gets the first three lines (version, copyright, and link). Where did the rest go? How do I get that too?
Don't know exactly why this is happening, but I'm going to make some changes to fix this issue in the next release.

The help data is in a xml file, embedded as a resource in the PDFShellTools.exe, that for sure you can extract and process using python.
You can use a tool such as the Resource Hacker to check the PDFShellTools.exe resources.
94
General / Using with python - truncated help
« Last post by ekopta on August 25, 2021, 06:18:20 PM »
I'm taking a stab at writing a python wrapper for PDF-ShellTools, and I'm wondering if anyone else at the forum has any experience with this. Specifically, I'm running PDFShellTools.exe with the subprocess package. This will suffice to let me work out the logic of what I'm trying to build, though I'd love to hear if anyone has used the dll from python. Heck, which dll?

First things first, I've hit a snag trying to capture the help message. When I don't capture the output, the full message is displayed in the Windows command line terminal. However, trying to capture the output to stdout only gets the first three lines (version, copyright, and link). Where did the rest go? How do I get that too?

Here's a MWE:
Code: (python) [Select]
import subprocess


class PdfTool(object):
    """Base class for PDF-ShellTools function classes."""

    def __init__(self, functionname=None, rundll=False):
        """Initialize class."""
        self.functionname = functionname
        self.rundll = rundll
        self.exename = 'PdfShellTools'
        self.params = []
        self.runsettings = {}

    def _run_dll(self):
        """Run tool via dll."""
        pass

    def _run_exe(self, captureoutput=False):
        """Run tool via command line exe."""
        toolargs = [self.exename, ]
        if self.functionname is not None:
            toolargs.append(self.functionname)
        cp = subprocess.run(toolargs, capture_output=captureoutput)
        return cp

    def run(self, captureoutput=False):
        """Run the tool in the preferred way."""
        if self.rundll:
            processdict = self._run_dll()
        else:
            processdict = self._run_exe(captureoutput=captureoutput)
        return processdict


def pdf_shelltools_help(captureoutput=False):
    """Return top-level PDF-ShellTools help."""
    return PdfTool().run(captureoutput=captureoutput)


print('###############################################################')
print('Output not captured')
print(pdf_shelltools_help())
print('\n\n')
print('###############################################################')
print('Output captured\n\n')
print(pdf_shelltools_help(captureoutput=True))


95
Ideas/Suggestions / Re: Extract/Split File Into Two Files
« Last post by nightslayer23 on August 13, 2021, 01:24:58 AM »
 :o oops. that was easy! Seriously, this is the best PDF software ever invented.
96
Ideas/Suggestions / Re: Extract/Split File Into Two Files
« Last post by RTT on August 12, 2021, 03:59:50 PM »
Use a semicolon character to specify multiple split operations.

1-270;3241-3374
97
Ideas/Suggestions / Extract/Split File Into Two Files
« Last post by nightslayer23 on August 12, 2021, 02:08:01 PM »
The extract / split allows you to only split files out into one file... what about if you want to split a file out into multiple files?

File 1 [pages: 1-270]
File 2 [pages: 3241-3374]

Pages would always vary..
98
General / Re: trim + bleed size
« Last post by RTT on July 13, 2021, 05:46:27 AM »
As with the Displaying PDF Page Size in Windows Explorer example, use the manager to create the 3 custom properties, named ArtSize, TrimSize and BleedSize.
Import and run the attached script to calculate and fill these properties, before they can show in the respective Windows File Explorer columns.
Code: [Select]
var ProgressBar = pdfe.ProgressBar;
ProgressBar.max = pdfe.SelectedFiles.Count;

for (var i = 0; i < pdfe.SelectedFiles.Count; i++) {
    ProgressBar.position = i + 1;
    var file = pdfe.SelectedFiles(i);
    var Page = file.Pages(0);
    var TrimSize = '';
    var BleedSize = '';
    var ArtSize = '';
    if (Page) {
        var TrimBox = Page.TrimBox ? Page.TrimBox : Page.CropBox ? Page.CropBox : Page.MediaBox;
        var BleedBox = Page.BleedBox ? Page.BleedBox : Page.CropBox ? Page.CropBox : Page.MediaBox;
        var ArtBox = Page.ArtBox ? Page.ArtBox : Page.CropBox ? Page.CropBox : Page.MediaBox;

        if (Page.Rotation == 90 || Page.Rotation == 270) {
            TrimSize = GetDist_mm(TrimBox.top, TrimBox.bottom).toFixed() + 'x' + GetDist_mm(TrimBox.left, TrimBox.right).toFixed() + ' mm';
            ArtSize = GetDist_mm(ArtBox.top, ArtBox.bottom).toFixed() + 'x' + GetDist_mm(ArtBox.left, ArtBox.right).toFixed() + ' mm';
        } else {
            TrimSize = GetDist_mm(TrimBox.left, TrimBox.right).toFixed() + 'x' + GetDist_mm(TrimBox.top, TrimBox.bottom).toFixed() + ' mm';
            ArtSize = GetDist_mm(ArtBox.left, ArtBox.right).toFixed() + 'x' + GetDist_mm(ArtBox.top, ArtBox.bottom).toFixed() + ' mm';
        }

        var BleedSize = GetDist_mm(BleedBox.top, TrimBox.top).toFixed() + ' mm';

        var FileMetadata = file.Metadata;
        var Changed = false;
        if (FileMetadata.TrimSize !== TrimSize) {
            FileMetadata.TrimSize = TrimSize;
            Changed = true;
        }

        if (FileMetadata.ArtSize !== ArtSize) {
            FileMetadata.ArtSize = ArtSize;
            Changed = true;
        }

        if (FileMetadata.BleedSize !== BleedSize) {
            FileMetadata.BleedSize = BleedSize;
            Changed = true;
        }

        if (Changed) {
            if (FileMetadata.CommitChanges()) {
                pdfe.echo(file.Filename + ' : (ArtSize=' + ArtSize + ', TrimSize=' + TrimSize + ', BleedSize=' + BleedSize + ') [OK]');

            } else {
                pdfe.echo(file.Filename + ' [commit failed]', 0xFF0000);
            }
        } else {
            pdfe.echo(file.Filename + ' : (ArtSize=' + ArtSize + ', TrimSize=' + TrimSize + ', BleedSize=' + BleedSize + ') [properties already set]');
        }
    }
}
pdfe.echo("Done");

function GetDist_mm(x1, x2) {
    return Math.abs(x1 - x2) * 25.4 / 72
}
99
Ideas/Suggestions / Re: Insert/Append Script for inserting one page over and over
« Last post by RTT on July 05, 2021, 03:35:16 PM »
I don't think Windows has a way to add custom shortcuts to File Explorer, or to shell context menu items.
But using the PDF-ShellTools command line interface, and some Windows tricks, this is doable.

  • Extract the attached .js script to a work folder.
  • Open it in a text editor and check if the path to the PDFShellTools.exe is pointing to where you have it on your system. Change accordingly.
  • Create a shortcut to CallShellTools.js, i.e. right click the CallShellTools.js file and execute the "create shortcut" option.
  • Cut the created shortcut and paste it in a Start Menu folder (How to Open the Start Menu Folder), e.g. in the PDF-ShelTools program group folder, C:\ProgramData\Microsoft\Windows\Start Menu\Programs\PDF-ShellTools.
  • Open the shortcut properties dialog and edit the "shortcut key" to enter the shortcut you want to use, and add the command line arguments to the "Target" field.
Examples:
To call the Merge tool, add Merge to the target field
To call a script named "Print Arguments", add RunScript "ScriptName=Print Arguments" to the target field.

Now you just need to select, in the Windows File Explorer, the PDF files you want to process, and press the keyboard shortcut you assigned.

You can repeat the process to create shortcuts to all the other tasks you use often.
100
General / Re: trim + bleed size
« Last post by nightslayer23 on July 05, 2021, 01:50:22 AM »
This is a handy Script! Could it be tweaked to instead of adding the bleed or trim box size to the filename, but add it to a custom handle in explorer?

TRIM BOX
BLEED BOX
ART BOX

All go to their own respective Property Handler ? (no filename change)
Pages: 1 ... 8 9 [10]