Recent Posts

Pages: 1 ... 4 5 [6] 7 8 ... 10
51
General / Re: PDF Explorer Web Interface, API based, Client.
« Last post by RTT on November 15, 2021, 08:29:02 PM »
Yes, still an active project.
52
General / Re: PDF Explorer Web Interface, API based, Client.
« Last post by Andi on November 15, 2021, 03:57:19 PM »
Hi i found this site today and first question is:

You still work on your software ?
53
General / Re: Using dll with python
« Last post by ekopta on October 28, 2021, 01:03:10 AM »
I should have mentioned that the dll only works with 32-bit Python installations.  :-[
54
General / Using dll with python
« Last post by ekopta on October 28, 2021, 12:59:26 AM »
I've found the way to use PdfShellTools.dll with python, and here's the basic recipe. This doesn't format the text input to all the particular specifications PdhShellTools requires; it's just about getting it to the dll.

Code: [Select]
from ctypes import c_int, WINFUNCTYPE, WinDLL
from ctypes.wintypes import HWND, HINSTANCE, LPSTR


def setup():
    """Set dll up to run."""
    DLLNAME = 'C:/Program Files (x86)/PDF-ShellTools/PDFShellTools.dll'
    dll = WinDLL(DLLNAME)
    prototype = WINFUNCTYPE(None, HWND, HINSTANCE, LPSTR, c_int)
    paramflags = ((1, 'hwnd', 0), (1, 'hinst', 0), (1, 'IpszCmdLine', ""),
                  (1, 'nCmdShow', 0))
    return (dll, prototype, paramflags)


def make_function(pdfstname, dll, prototype, paramflags):
    """Make a function to run PdfShellTools action from python."""
    return prototype((pdfstname, dll), paramflags)


def run_dll_function(function, param, file):
    """Run function in dll. Format param & file nicely elsewhere."""
    dllinput = param + " " + file
    function(IpszCmdLine=LPSTR(dllinput.encode('utf-8')))


dll, prototype, paramflags = setup()
set_metadata = make_function('SetMetadata', dll, prototype, paramflags)
pdfstparams = '"Metadata=Title=SomeTitle"'
pdfstfiles = 'afile.pdf'
run_dll_function(set_metadata, pdfstparams, pdfstfiles)

My guess is that you only want to do the setup part once to realize the full speed gain. It's probably good to minimize the calls to make_function as well. I haven't looked into performance concerns yet.
55
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.
56
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



57
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.
58
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))


59
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.
60
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
Pages: 1 ... 4 5 [6] 7 8 ... 10