pdftk | Mirror of pdftk - | Document Editor library

 by   ericmason Java Version: Current License: No License

kandi X-RAY | pdftk Summary

kandi X-RAY | pdftk Summary

pdftk is a Java library typically used in Editor, Document Editor applications. pdftk has no vulnerabilities and it has high support. However pdftk has 413 bugs and it build file is not available. You can download it from GitHub.

If PDF is electronic paper, then pdftk is an electronic staple-remover, hole-punch, binder, secret-decoder-ring, and X-Ray-glasses. Pdftk is a simple tool for doing everyday things with PDF documents.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              pdftk has a highly active ecosystem.
              It has 43 star(s) with 27 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              There are 6 open issues and 0 have been closed. On average issues are closed in 1610 days. There are no pull requests.
              OutlinedDot
              It has a negative sentiment in the developer community.
              The latest version of pdftk is current.

            kandi-Quality Quality

              OutlinedDot
              pdftk has 413 bugs (6 blocker, 0 critical, 147 major, 260 minor) and 5738 code smells.

            kandi-Security Security

              pdftk has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              pdftk code analysis shows 0 unresolved vulnerabilities.
              There are 8 security hotspots that need review.

            kandi-License License

              pdftk does not have a standard license declared.
              Check the repository for any license declaration and review the terms closely.
              OutlinedDot
              Without a license, all rights are reserved, and you cannot use the library in your applications.

            kandi-Reuse Reuse

              pdftk releases are not available. You will need to build from source code and install.
              pdftk has no build file. You will be need to create the build yourself to build the component from source.
              pdftk saves you 45256 person hours of effort in developing the same functionality from scratch.
              It has 53203 lines of code, 3801 functions and 313 files.
              It has high code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi has reviewed pdftk and discovered the below as its top functions. This is intended to give you an instant insight into pdftk implemented functionality, and help decide if they suit your requirements.
            • Adds an imported page to the output
            • Translates a PRDictionary to a PdfDictionary
            • Translate a PR - object to a Pdf - object
            • Translates a PRIndirectReference to a PdfIndirectReference
            • Generate a key pair
            • Returns a vector of first primes
            • Retrieves an integer
            • Randomly permutes a vector
            • Returns a single CID font
            • Main entry point for testing
            • Sets a field property
            • Read the font metrics
            • Verify a signature
            • Writes the font to the specified writer
            • Gets a new text field
            • Reads the font data
            • Wrap a byte array
            • Gets a new signature name
            • Sets the subkeys
            • Generates a PdfWriter
            • Fill the array
            • Encodes the given data into Base64
            • Gets the full font
            • Unwrap a byte array
            • Type 1
            • Initialize the cipher
            Get all kandi verified functions for this library.

            pdftk Key Features

            No Key Features are available at this moment for pdftk.

            pdftk Examples and Code Snippets

            No Code Snippets are available at this moment for pdftk.

            Community Discussions

            QUESTION

            Batch for removing last 2 pages from PDF files on a folder
            Asked 2022-Mar-13 at 12:07

            I am using the PDFtk to remove last 2 pages of a bunch of PDF from a specific folder.

            For removing it individually on a file, this code works perfectly fine as the last two pages are removed from original.pdf and a newly created reduced.pdf copy is created without the last two pages

            ...

            ANSWER

            Answered 2022-Mar-13 at 12:07

            The task can be done with a batch file with only following single command line:

            Source https://stackoverflow.com/questions/71326520

            QUESTION

            Convert PDF to get vectorized text ("convert all text to outlines")
            Asked 2022-Feb-25 at 09:04

            I'm using nodejs and I'm processing PDFs. One thing I'd like to do is to outline all the fonts of the PDF (so that they are not selectable with the mouse cursor afterwards).

            I tried the pdftk's flatten command (using a node wrapper), but I did not get what I wanted.

            I may have a track in using inkscape (command line), but I'm not even sure about how to do it. I really am looking for the easiest way to do that using nodejs.

            There might also be a track using ghostscript: https://stackoverflow.com/a/28798374/11348232. One notable thing to notice is that I don't use files on disk, but Buffer objects, so it'd be painful to save the PDF locally then use the gs command.

            Thanks a lot.

            ...

            ANSWER

            Answered 2022-Feb-25 at 09:04

            I finally followed @KenS way:

            Source https://stackoverflow.com/questions/71235810

            QUESTION

            Fill pdf form image field with image
            Asked 2022-Jan-27 at 13:54

            I have tried to use pdftk to fill a PDF form with text and images. Filling out text fields works fine, but it cant seem to add an image to an PDF form image field.

            Is there any way to add an image to a form field with pdftk ? Or any other way to do this?

            Heres my pdf: https://easyupload.io/b1emej

            Heres my code

            ...

            ANSWER

            Answered 2022-Jan-27 at 13:54

            It is possible to carry an image via FDF however the aim of Forms Data is to carry simple text objects such as text field entries or other comments. So for an image it needs to be as separate annotation stamp and unsure if that can be attached to a field as such.

            Here is a stamp added to the "clean" file ( note it is "under" the field entries)

            Source https://stackoverflow.com/questions/70830796

            QUESTION

            Fill a PDF form with default data
            Asked 2022-Jan-20 at 22:48

            I am working on editing a PDF form/template in Ruby On Rails application. I want to populate some of form fields with data from database and make few fields editable to take the input from user. I found PDFtf but I read that this is very old library and hardly works with the new Linux/Mac versions. I checked https://www.adamalbrecht.com/blog/2014/01/31/pre-filling-pdf-form-templates-in-ruby-on-rails-with-pdftk/

            ...

            ANSWER

            Answered 2022-Jan-20 at 22:48

            Form fields are in FDF/XFDF files (very similar to a PDF as they are the data overlay) they are old hat but in constant use daily the library you link to is maintained this year and last stable release was October 2020 it is the old proprietary Adobe Forms methodology that is very much stable since turn of the century.

            see https://github.com/jkraemer/pdf-forms#fdfxfdf-creation for how it uses PDFtk to adjust the FDFs

            It does not matter which language or library you use the data is best kept static . I can write PDF via cmd so i guess fdf as text or xfdf as xml is just as easy.

            best kept in simpler FDF format since for users its easiest to use a PDF/FDF reader / forms modifier such as Acrobat, Tracker or Foxit etc.

            You can use any of those API s or just as simply use a find and replace method but its easiest to use a paid tool like PDFTK that can resolve the backgound mathematics. $79 for your server version will pay for itself quickly. Even $3 for a personal pro version is a bargain.

            For a Ruby specific method using PDFtk last updated 28 Dec 2021 see https://github.com/ruby-journal/nguyen

            Source https://stackoverflow.com/questions/70793552

            QUESTION

            pdftk update_info command raising a warning which I don't understand
            Asked 2022-Jan-18 at 15:15

            I'm trying to use the update_info command in order to add some bookmarks to an existing pdf's metadata using pdftk and powershell.

            I first dump the metadata into a file as follows:

            pdftk .\test.pdf dump_data > test.info

            Then, I edit the test.info file by adding the bookmarks, I believe I am using the right syntax. I save the test.info file and attempt to write the metadata to a new pdf file using update_info:

            pdftk test.pdf update_info test.info output out.pdf

            Unfortunately, I get a warning as follows:

            pdftk Warning: unexpected case 1 in LoadDataFile(); continuing

            out.pdf is generated, but contains no bookmarks. Just to be sure it is not a syntax problem, I also ran it without editing the metadata file, by simply overwriting the same metadata. I still got the same warning.

            Why is this warning occurring? Why are no bookmarks getting written to my resulting pdf?

            ...

            ANSWER

            Answered 2022-Jan-18 at 15:15

            using redirection in that fashion

            pdftk .\test.pdf dump_data > test.info

            will cause this known problem by building wrong file structure, so change to

            Source https://stackoverflow.com/questions/70753672

            QUESTION

            Self-hosted gitlab runner. PATH environment variable has different contents than regular powershell
            Asked 2021-Dec-30 at 16:53

            After some initial problems I was finally able to set up a self-hosted GitLab Runner on my personal laptop.

            I'm now looking into how this runner works and how I can tweak it's environment to my needs. I modified the YML file to run a simple command echoing the PATH environment variable:

            ...

            ANSWER

            Answered 2021-Dec-30 at 16:53

            There's a few reasons why environment variables may be different. Chiefly:

            1. The user account being used by the runner
            2. The powershell profile you're using locally (which will not be used by the runner)
            3. Any changes to environment variables made in the runner's config.toml
            4. environment variables changed/added through CI/CD variables.
            User account

            The effective PATH is a combination of both the system environment variables as well as user environment variables. For your runner to reflect the same environment variables that you see locally when running powershell, you must use the same user account, otherwise user environment variables you're seeing may be missing/different based on the user account.

            One way to fix differences that may be caused by the user would be to change the user used by the gitlab service

            To change the user used by the GitLab runner, go to services -> gitlab-runner -> (right-click) properties -> Log On tab and choose the account the runner should use.

            Alternatively, specify this when installing the runner:

            Source https://stackoverflow.com/questions/70532683

            QUESTION

            File extensions missing from Python Lambda Lambda Dependency. Will this cause my Function to fail?
            Asked 2021-Nov-22 at 21:09

            I was given a .zip file that had an external library called Python PDF Toolkit, often abbreviated as pdftk or pypdftk.

            To my current knowledge, this external dependency was built on a EC2 instance of CentOS6, because the pdftk has its own dependency called libgcj.

            As you can see from the image, most of the files are Unix Executable Files, and are missing their file extensions.

            1. Will this create problems in Lambda? I believe the pdftk needs to be uploaded as a Lambda Layer to help extend the standard core Python Library.

            2. If this will create problems executing Lambda, are there any steps I can take to find the file extensions?

            Lastly, I can edit this question and add the code within these files if you believe that will help.

            WHEEL

            ...

            ANSWER

            Answered 2021-Nov-22 at 21:09

            pypdftk is a wrapper for pdftk binary. So you need 2 things:

            1. Install the pdftk binary as a Lambda Layer. For more details look here.
            2. You also need the python code. It seems that this is only a python file. You can either copy it directly or your code or install it with pip. It should work with python 3.

            You have been provided with a wheel package. Chances are that it won't work with lambda and python 3, although it isn't impossible to properly configure everything. It should be easier to install pypdftk and binary dependencies from scratch.

            Source https://stackoverflow.com/questions/70069978

            QUESTION

            Lambda Python Dependency Package ERROR Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'surveys'
            Asked 2021-Nov-17 at 21:17

            EDIT 3:
            So the problem may likely be in the set-up and configuration of my Lambda Layer Dependencies. I have a /bin directory containing 3 files:

            • lambdazip.sh
            • pdftk
            • libgcj.so.10

            pdftk is a pdf library, and libgcj is a dependency for PDFtk.
            lambdazip.sh seems to set & modify PATH Variables.

            I have tried uploading all 3 as 1 lambda layer.
            I have tried uploading all 3 as 3 separate lambda layers.
            I have not tried customizing the .zip file names, I know sometimes the Lambda Layer wants you to name the .zip file a specific name dependent on the language.
            I have not tried customizing the "compatible architectures" & "compatible runtime" lambda layer settings.

            EDIT 2:
            I tried renaming the Lambda Layer as Python.zip because I heard that sometimes you need a specific naming convention for the Lambda Layer to work correctly. This also failed & produced the same error.

            EDIT:
            I have tried pulling the .py files out of the /surveys directory, so when they are zipped, they are in the root folder, but I still receive the same error: Runtime.ImportModuleError: Unable to import module 'lambda_function': No module named 'surveys

            Which files do I need to zip? Do I need to move certain files to the root?
            I learned that I had accidentally zipped the directory which commonly caused this error.
            I needed to zip the contents of the directory, which is a common solution.
            Unfortunately this did not work for me.

            I have a Lambda Function, and the code I have uploaded is a zipped folder of my /Archive directory.
            From what I understand, many of the people who run into this "[ERROR] Runtime.ImportModuleError: Unable to import module 'lambda_function':" have issues because of their Lambda Handler.

            My Lambda handler is: lambda_function.lambda_handler so this doesn't appear to be my issue.

            Another common problem I've noticed on Stackoverflow, appears to be with how people are compressing & zipping the files they upload to the Lambda Function.

            Do I need to move my lambda_function.py? Sometimes this CloudWatch error occurs because the lambda_function.py is not in the ROOT directory.

            Does my survey directory need to move?

            I think the folders & directories I have here may be causing my issue.

            Do I need to zip the directories individually?

            Can I resolve this error by Zipping the entire project?

            For more information, I also have a Lambda Layer for PDF Toolkit, called pyPDFtk in the codebase. In that Lambda layer is a zipped /bin with binaries inside.

            If there is anything I can alter/change within my code or AWS configuration, please let me know, and I can return new CloudWatch error logs for you.

            lambda_function.py

            ...

            ANSWER

            Answered 2021-Nov-14 at 10:26

            I tried to replicate the issue, but it all works as expected. My setup was (Lambda with Python 3.9):

            It seems to me that either your directory struct is not what you posted in the question. Similarly your real code that you present in SO could be different.

            Source https://stackoverflow.com/questions/69902669

            QUESTION

            Including result of string joining command in command line tool call powershell 5.0
            Asked 2021-Nov-15 at 19:32

            I would like to include the result of a string concatenation command as part of a call using the pdftk command line tool. Here's what I tried:

            ...

            ANSWER

            Answered 2021-Nov-15 at 09:49

            In this kind of situation invoke-expression is your friend:

            Source https://stackoverflow.com/questions/69972128

            QUESTION

            How does windows decide which python executable to use when multiple are defined in $env:path?
            Asked 2021-Oct-25 at 16:29

            I have several python executables available from within a default powershell prompt as shown by where.exe python:

            ...

            ANSWER

            Answered 2021-Oct-23 at 21:36

            What Windows will execute is not trivial, since it might depend on the API used.

            One of them is CreateProcessW:

            1. The directory from which the application loaded.
            2. The current directory for the parent process.
            3. The 32-bit Windows system directory. Use the GetSystemDirectory function to get the path of this directory.
            4. The 16-bit Windows system directory. There is no function that obtains the path of this directory, but it is searched. The name of this directory is System.
            5. The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
            6. The directories that are listed in the PATH environment variable. Note that this function does not search the per-application path specified by the App Paths registry key. To include this per-application path in the search sequence, use the ShellExecute function.

            Since Windows Vista, the environment variable %NoDefaultCurrentDirectoryInExePath% configures whether or not the current directory should be searched (Source: MSDN).

            Also: if you just run python without an extension, the environment variable %PathExt% is used to find executable extensions. (Source: MSDN).

            The default value for the PATHEXT variable is: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

            A great tool for troubleshooting such issues is SysInternals Process Monitor. Set a filter for "path contains python" (not python.exe) and you'll see the exact search order. It will report "NO SUCH FILE" for directories which do not contain a Python executable.

            Also note: the search order for DLLs may be different.

            Source https://stackoverflow.com/questions/69691613

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install pdftk

            You can download it from GitHub.
            You can use pdftk like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the pdftk component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/ericmason/pdftk.git

          • CLI

            gh repo clone ericmason/pdftk

          • sshUrl

            git@github.com:ericmason/pdftk.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link