Author Topic: PDFtk for OS/2 would be nice!  (Read 6366 times)

Martin Vieregg

  • Sr. Member
  • ****
  • Posts: 278
  • Karma: +2/-0
    • View Profile
PDFtk for OS/2 would be nice!
« on: May 30, 2020, 10:07:57 am »
Sometimes I start Windows only for concatenating PDF files to a single PDF file with the commandline tool

pdftk

It is much better than the (?) gs based epdf OS/2 tool.

The name of the commandline version is pdftk-server

Here is the homepage where the source is available.

Here is a part of the docu:
Code: [Select]
EXAMPLES
       Collate scanned pages
         pdftk A=even.pdf B=odd.pdf shuffle A B output collated.pdf
         or if odd.pdf is in reverse order:
         pdftk A=even.pdf B=odd.pdf shuffle A Bend-1 output collated.pdf

       Decrypt a PDF
         pdftk secured.pdf input_pw foopass output unsecured.pdf

       Encrypt a PDF using 128-bit strength (the default), withhold all per-
       missions (the default)
         pdftk 1.pdf output 1.128.pdf owner_pw foopass

       Same as above, except password 'baz' must also be used to open output
       PDF
         pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz

       Same as above, except printing is allowed (once the PDF is open)
         pdftk 1.pdf output 1.128.pdf owner_pw foo user_pw baz allow printing

       Join in1.pdf and in2.pdf into a new PDF, out1.pdf
         pdftk in1.pdf in2.pdf cat output out1.pdf
         or (using handles):
         pdftk A=in1.pdf B=in2.pdf cat A B output out1.pdf
         or (using wildcards):
         pdftk *.pdf cat output combined.pdf

       Remove page 13 from in1.pdf to create out1.pdf
         pdftk in.pdf cat 1-12 14-end output out1.pdf
         or:
         pdftk A=in1.pdf cat A1-12 A14-end output out1.pdf

       Apply 40-bit encryption to output, revoking all permissions (the
       default). Set the owner PW to 'foopass'.
         pdftk 1.pdf 2.pdf cat output 3.pdf encrypt_40bit owner_pw foopass

       Join two files, one of which requires the password 'foopass'. The out-
       put is not encrypted.
         pdftk A=secured.pdf 2.pdf input_pw A=foopass cat output 3.pdf

       Uncompress PDF page streams for editing the PDF in a text editor (e.g.,
       vim, emacs)
         pdftk doc.pdf output doc.unc.pdf uncompress

       Repair a PDF's corrupted XREF table and stream lengths, if possible
         pdftk broken.pdf output fixed.pdf

       Burst a single PDF document into pages and dump its data to
       doc_data.txt
         pdftk in.pdf burst

       Burst a single PDF document into encrypted pages. Allow low-quality
       printing
         pdftk in.pdf burst owner_pw foopass allow DegradedPrinting

       Write a report on PDF document metadata and bookmarks to report.txt
         pdftk in.pdf dump_data output report.txt

       Rotate the first PDF page to 90 degrees clockwise
         pdftk in.pdf cat 1east 2-end output out.pdf

       Rotate an entire PDF document to 180 degrees
         pdftk in.pdf cat 1-endsouth output out.pdf

It would be really useful to port the project for OS/2. It is available for several Unixes, for Windows and for MacOS. So I assume that porting should be possible with not too much work.

Joop

  • Hero Member
  • *****
  • Posts: 633
  • Karma: +5/-0
    • View Profile
Re: PDFtk for OS/2 would be nice!
« Reply #1 on: May 30, 2020, 03:08:44 pm »
Why not use Java? There is a program which does what you want, see http://joopn.home.xs4all.nl/os2ecs/ecs6e42.htm or in Dutch http://joopn.home.xs4all.nl/os2ecs/ecs6n42.htm. I also search for pdf now I know there is some interest in it. Found a view programs, but as always, we are behind with the Java version, needs updating to 11 to be on the save side, because when its available for OS/2 this will be the new minimum version.

@Silvan, not sure what you want to tell us.

Have fun and stay healthy,
Joop

Remy

  • Hero Member
  • *****
  • Posts: 760
  • Karma: +12/-1
    • View Profile
Re: PDFtk for OS/2 would be nice!
« Reply #2 on: May 30, 2020, 03:10:40 pm »
You can use Ghostscript too .

A simple Ghostscript command to merge two PDFs in a single file is shown below:
gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=combine.pdf -dBATCH 1.pdf 2.pdf


Update: pdftk seems to be close to pdfill
http://www.pdfill.com/pdf_tools_free.html

It works great and based on ghostscript  (needs a GUI)
« Last Edit: May 31, 2020, 01:30:27 pm by Remy »

Dave Yeo

  • Hero Member
  • *****
  • Posts: 5084
  • Karma: +117/-1
    • View Profile
Re: PDFtk for OS/2 would be nice!
« Reply #3 on: May 30, 2020, 05:42:37 pm »
Actually it seems to be a Java program that is built with GCJ, which IIRC, is the Gnu Compiler for Java, which used to be part of the Gnu Compiler Collection and according to Wiki, hasn't been maintained since 2017.
While I have a vague memory of Paul building an experimental port of GCJ at one point, I don't know if it was ever really tested, which version of GCC it was included with and how to use, as in do you need a Java SDK or other libraries.
So in short, not simple to port due to lack of tools.

Joop

  • Hero Member
  • *****
  • Posts: 633
  • Karma: +5/-0
    • View Profile
Re: PDFtk for OS/2 would be nice!
« Reply #4 on: May 30, 2020, 05:47:24 pm »
Okay, I downloaded 10 programs out of 652 Java "programs" with the word "pdf". These are programs with a gui, looking at remarks and date no problem for Java 6, this is not said that it will also run, there might be specific OS lib's included. I just downloaded and stored it on disk. Have to see what this is, if I can install and run it first time it will end up in the page test phase http://joopn.home.xs4all.nl/os2ecs/ecs6e46.htm or in Dutch http://joopn.home.xs4all.nl/os2ecs/ecs6n46.htm. That's it for now.

Have fun,
Joop

ivan

  • Hero Member
  • *****
  • Posts: 1601
  • Karma: +20/-0
    • View Profile
Re: PDFtk for OS/2 would be nice!
« Reply #5 on: May 30, 2020, 09:11:20 pm »
I have been using Pdfsam (the first one Joop mentioned) for years, there is also jPDFtweak, but that one takes much more time to learn to use.

There are others, but those two do what I want.

Joop

  • Hero Member
  • *****
  • Posts: 633
  • Karma: +5/-0
    • View Profile
Re: PDFtk for OS/2 would be nice!
« Reply #6 on: May 31, 2020, 01:56:08 am »
Update, 2 out of the 10 downloaded programs didn't work with Java 6 and needed already Java 7. 1 of the programs was not intended to be used stand alone and through the website and discussions it was used as a plugin for eclips, and we don't have that. 1 program had a corrupt main directory and couldn't be opened "my way". 1 program did install, but after installation complained about Java 6. 4 out of 10 are to stay, added them to the list. 2 out of 10 does do something with pdf, but are something else. One need mysql, we have that, but need to find out more, because this is new and mysql is new. Up to now I always gave Java programs which needed Java and nothing more. If I can get it running, then there are some more Java programs like Squirrel and so on. One copied to a directory, but reading the sh and bat files, it can be done much easier, have to experiment. Not bad for one night.