Coder Social home page Coder Social logo

pdfjam's Introduction

GitHub CI

pdfjam

Reuben Thomas https://rrt.sc3d.org/

A snapshot of this page is included as README.md in the distributed package. The most up-to-date version is maintained online at https://github.com/rrthomas/pdfjam.

  1. Overview
  2. Pre-requisites
  3. Documentation
  4. Installation
  5. Configuration
  6. Using pdfjam
  7. FAQ
  8. Reporting bugs
  9. Version history

The pdfjam package makes available the pdfjam shell script that provides a simple interface to much of the functionality of the excellent pdfpages package (by Andreas Matthias) for LaTeX. The pdfjam script takes one or more PDF files (and/or JPG/PNG graphics files) as input, and produces one or more PDF files as output. It is useful for joining files together, selecting pages, reducing several source pages onto one output page, etc., etc.

A potential drawback of pdfjam and other scripts based upon it is that any hyperlinks in the source PDF are lost.

pdfjam is designed for Unix-like systems, including Linux and Mac OS X. It seems that it will work also on Windows computers with a suitable installation of Cygwin (with TeX Live installed), but this has not been thoroughly tested.

Alternatives to pdfjam which are widely packaged in GNU/Linux distributions and other free software collections include:

Those alternatives do many of the same things as pdfjam, and maybe quite a bit more too.

The pdfjam software is made available free, under GPL version 2 (see the file named COPYING that is included with the package). It comes with ABSOLUTELY NO WARRANTY of fitness for any purpose whatever.

Previous versions of pdfjam (before 3.02) included some other scripts too, in addition to the pdfjam script iteslf. Those other scripts are simple wrappers for calls to pdfjam, designed to perform some common tasks such as joining or n-upping PDF files or to illustrate other features; they are not very elaborate, and nor are they extensively tested. They are probably best viewed as simple templates that can be used for constructing more elaborate wrapper scripts as required.

Those 'wrapper' scripts are no longer maintained. I continue to make them available in a separate repository https://github.com/rrthomas/pdfjam-extras, in case anyone wants to see them, to use them, or to improve and maintain them independently as a separate project.

The specific wrapper scripts that were removed from the pdfjam package at version 3.02 are:

  • pdfnup, pdfpun
  • pdfjoin
  • pdf90, pdf180, pdf270
  • pdfflip
  • pdfbook
  • pdfjam-pocketmod
  • pdfjam-slides3up, pdfjam-slides6up

For those scripts and for more information on them, please now see https://github.com/rrthomas/pdfjam-extras.

  • A Unix-like operating system (Linux, Mac OS X, FreeBSD, etc.; possibly Cygwin)
  • A working, up-to-date installation of LaTeX (including at least one of pdflatex, lualatex or xelatex)
  • A working installation of the LaTeX package pdfpages (version 0.4f or later) and geometry.

With libpaper version 2 or later installed, pdfjam will be able to find your default paper size, which you can configure if desired.

For some years now, pdfjam has been included in the TeX Live distribution, which includes all the necessary programs and packages to make pdfjam run smoothly. If you have the necessary bandwidth and disk space for it, I do recommend installing TeX Live.

Documentation

The primary documentation for pdfjam is obtained (after installation of pdfjam) via the command

pdfjam --help

This gives information on the arguments to pdfjam, and the default settings that apply at your installation. In addition to the arguments that are explicitly documented there, pdfjam provides access to all of the options of the pdfpages package: that's a large number of options, and it's a set of options that might change, so users are referred to the current pdfpages manual (PDF) to see what's available.

In case you want to look at the pdfjam --help text template online, for example before you decide whether to install pdfjam, the source is available at https://github.com/rrthomas/pdfjam/blob/master/pdfjam-help.txt.

There is also a (very basic) man page, accessed in the usual way (after installation) by

man pdfjam

Installation

There are two main ways:

  1. Install the current TeX Live distribution (how you do this will depend on details of your operating system). TeX Live will already contain a recent release of pdfjam. Many thanks to Karl Berry for setting up and maintaining pdfjam as a CTAN package that is part of TeX Live.

  2. Install it yourself (e.g., if you don't want TeX Live, or if you want a later release of pdfjam than the one that's currently in TeX Live). Download the latest packaged release of pdfjam from https://github.com/rrthomas/pdfjam/releases. If for some reason you don't want the latest released version, or even a recently released version, you can still get older versions too: see https://davidfirth.github.io/pdfjam.

The first way, via TeX Live, is recommended as the easiest way for most users.

If you go the second way, then you will have a bit more to do:

  • The pdfjam shell script in the bin sub-directory of the released package should be placed on the PATH of anyone who needs to use it.
  • The man file in the man1 sub-directory should be installed on the MANPATH of all who might need to read it.

Configuration

On many unix-like systems pdfjam should run without any further configuration, provided that the pre-requisite TeX installation (such as TeX Live) is present. If you want to check (e.g., prior to installation) that pdfjam will work on your system, then

  • unzip the tests.zip archive (inside the package)
  • cd to your newly made tests sub-directory and follow the instructions that appear there in README_tests.md.

If configuration is needed, this can be done through a site-wide or user-specific configuration file. This might be necessary if, for example, your site has a non-standard TeX installation, or a non-standard location for temporary files, or a specific paper size for output PDFs --- or some other reason.

The file pdfjam.conf is a sample configuration file which can be edited as needed. After editing, either install the file for site-wide use (at /etc/pdfjam.conf, /usr/share/etc/pdfjam.conf, /usr/local/share/pdfjam.conf, or /usr/local/etc/pdfjam.conf) or as a user-defaults file at ~/.pdfjam.conf. User settings made at ~/.pdfjam.conf override corresponding settings made in a site-wide configuration file.

For example, if you prefer to use /usr/bin/xelatex as your default LaTeX engine (in place of the standard pdflatex), and you want your output page size to be "US letter" size paper by default, you would simply include the lines

latex=/usr/bin/xelatex
paper=letterpaper

in a plain text file named '.pdfjam.conf' in your home directory. The path usr/bin/xelatex specifies exactly which LaTeX program will be used: it could be a path to any one of the pdflatex, lualatex or xelatex executables. (You can get the full path to an executable by, for example, the command which xelatex.) The code word letterpaper is how LaTeX refers to that particular page size. For other available paper sizes, and all the many other options that could be set as defaults if you want, please see the output of

pdfjam --help

On some systems it might even be necessary to change the list of places (i.e., /etc/pdfjam.conf and others as listed above) that is searched for site-wide configuration files. This can only be done by editing the pdfjam script itself. To see which directories on your system are searched for a file named pdfjam.conf, look at the output of

pdfjam --configpath

Using pdfjam

For a full overview of what pdfjam can do, the importance of the pdfpages manual (PDF) cannot be stressed enough! The following examples merely serve as a brief introduction.

Example 1: Batch 2-upping of documents

Consider converting each of two documents to a side-by-side "2-up" format. Since we want the two documents to be processed separately, we'll use the --batch option:

pdfjam --batch --nup 2x1 --suffix 2up --landscape file1.pdf file2.pdf

This will produce new files file1-2up.pdf and file2-2up.pdf in the current working directory.

Example 2: Merging pages from 2 documents

Suppose we want a single new document which puts together selected pages from two different files:

pdfjam file1.pdf '{},2-' file2.pdf '10,3-6' --outfile ../myNewFile.pdf

The new file myNewFile.pdf, in the parent directory of the current one, contains an empty page, followed by all pages of file1.pdf except the first, followed by pages 10, 3, 4, 5 and 6 from file2.pdf.

The resulting PDF page size will be whatever is the default paper size for you at your site. If instead you want to preserve the page size of (the first included page from) file1.pdf, use the option --fitpaper true.

All pages in an output file from pdfjam will have the same size and orientation. For joining together PDF files while preserving different page sizes and orientations, pdfjam is not the tool to use.

Example 3: A 4-up document with frames

To make a portrait-oriented 4-up file from the pages of three input files, with a thin-line frame around the input pages:

pdfjam file1.pdf file2.pdf file3.pdf --no-landscape --frame true --nup 2x2 --suffix 4up --outfile ~/Documents

Here a directory was specified at --outfile: the resultant file in this case will be ~/Documents/file3-4up.pdf. (Note that if there's a writeable file with that name already, it will be overwritten: no check is made, and no warning given.)

Example 4: Convert a 'US letter' document to A4

Suppose we have a document made up of 'US letter' size pages, and we want to convert it to A4:

pdfjam 'my US letter file.pdf' --a4paper --outfile 'my A4 file.pdf'

Example 5: Handouts from presentation slides

A useful application of pdfjam is for producing a handout from a file of presentation slides. For slides made with the standard 4:3 aspect ratio a nice 6-up handout on A4 paper can be made by

pdfjam --nup 2x3 --frame true --noautoscale false --delta "0.2cm 0.3cm" --scale 0.95 myslides.pdf --outfile myhandout.pdf

The --delta option here comes from the pdfpages package; the --scale option is passed to LaTeX's \includegraphics command.

Slides made by LaTeX's beamer package, using the handout class option, work especially nicely with this! The example wrapper scripts pdfjam-slides3up and pdfjam-slides6up, in the pdfjam-extras repository, are for 3-up and 6-up handouts, respectively.

Example 6: Trimming pages; and piped output

Suppose we want to trim the pages of our input file prior to n-upping. This can be done by using a pipe:

pdfjam myfile.pdf --trim '1cm 2cm 1cm 2cm' --clip true --outfile /dev/stdout | pdfjam --nup 2x1 --frame true --outfile myoutput.pdf

The --trim option specifies an amount to trim from the left, bottom, right and top sides respectively; to work as intended here it needs also --clip true. These (i.e., trim and clip) are in fact options to LaTeX's \includegraphics command (in the standard graphics package).

Thanks go to Christophe Lange and Christian Lohmaier for suggesting an example on this.

Example 7: Output pages suitable for binding

To offset the content of double-sided printed pages so that they are suitable for binding with a Heftstreifen, use the --twoside option:

pdfjam --twoside myfile.pdf --offset '1cm 0cm' --suffix 'offset'

Example 8: Input file with nonstandard name

To use PDF input files whose names do not end in '.pdf', you will need to use the --checkfiles option. This depends on the availability of the file utility, with support for the options -Lb; this can be checked by trying

file -Lb 'my PDF file'

where 'my PDF file' is the name of a PDF file on your system. The result should be something like 'PDF document, version 1.4' (possibly with a different version number).

With 'file -Lb' available, we can use PDF files whose names lack the usual '.pdf' extension. For example,

pdfjam --nup 2x1 --checkfiles 'my PDF file'

will result in a file named 'my PDF file-2x1.pdf' in the current working directory.

Example 9: Rotate every 2nd page

If you want to print a landscape-oriented PDF document on both sides of the paper, using a duplex printer that does not have 'tumble' capability, make a new version with every second page rotated for printing:

pdfjam --landscape --doublepagestwistodd true my-landscape-document.pdf

FAQ

1. The script runs but the output doesn't look the way it should. Why?

Most likely either your pdfTeX or your pdfpages installation is an old version. You could check also that pdftex.def, typically to be found in .../texmf/tex/latex/graphics/, is up to date. If the problem persists even with up-to-date versions of pdfTeX, pdftex.def and pdfpages, then please do report it.

2. What can I do to solve a 'Too many open files' error?

This error has been reported to occur sometimes, when dealing with large numbers of documents/pages. A suggested solution, if this happens, is to include additionally (in the call to pdfjam):

    -- preamble '\let\mypdfximage\pdfximage \def\pdfximage{\immediate\mypdfximage}'

See for example https://stackoverflow.com/questions/1715677/error-too-many-open-files-in-pdflatex for this suggestion and links to more information.

Reporting bugs

Please report any bugs found in pdfjam, either

Some known problems:

  • Sometimes font information (such as ligatures) is lost from the output of pdfjam. It seems that a fairly simple fix when this happens is to add the option --preamble '\pdfinclusioncopyfonts=1' in your call to pdfjam.
  • In Cygwin, using pdfjam in a pipeline does not seem to work. The problem seems to be with Cygwin's handling of file descriptors within pipelines.
  • The --preamble option can sometimes clash with other elements of the LaTeX preamble. Some specific things to watch out for:
    • If the preamble needs to set further options to the geometry package, be sure to use the \geometry{} command for that.
    • If options to the color package are to be specified in the preamble, do not at the same time use the --pagecolor option to pdfjam.

Overview of the history

This all grew originally from a script named pdfnup. That was later joined, in a published package called 'PDFjam', by two further scripts pdfjoin and pdf90.

At version 2.00, everything was unified through a single script pdfjam, with many more options. Along with pdfjam various 'wrapper' scripts --- i.e., other scripts that use pdfjam in different ways --- were provided, mainly as examples.

From version 3.02, the extra 'wrapper' scripts are removed from the package, mainly because they are hard to maintain: different users want different things, and pdfjam itself provides all the options in any case. So I have broken out the wrapper scripts into a separate repository, unsupported --- so that people can still see and use/adapt them if they want. And maybe even someone else will want to take on the task of improving and maintaining some of them, who knows? The wrapper scripts (no longer maintained) can now be found at https://github.com/rrthomas/pdfjam-extras.

Releases up to version 2.08 are still available at https://davidfirth.github.io/pdfjam.

pdfjam's People

Contributors

arakmar avatar davidfirth avatar eric-j-ason avatar golvok avatar guillaumefromage avatar lemniscati avatar lucas-c avatar rrthomas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pdfjam's Issues

Empty page ({}) not empty but is another named page

$ pdfjam --version
2.08
$ pdfjam -o result.pdf test.pdf '{},1'

Problem:

  • The first page in result.pdf is not empty ({}) but is the first page of
    test.pdf
  • The second page in result.pdf is also the first page of test.pdf (correct)

[Bug] pdfjam ERROR: --outfile cannot be a directory when input is stdin

I have no idea what the reason for this message is:

 pdfjam-pocketmod 8.pdf
          ----
  pdfjam: This is pdfjam version 3.03.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: Effective call for this run of pdfjam:
          /usr/bin/pdfjam --outfile /dev/stdout -- 8.pdf 1-8 
  pdfjam: Calling /usr/bin/pdflatex...
  pdfjam: Finished.  Output was written to '/dev/stdout'.
          ----
  pdfjam: This is pdfjam version 3.03.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: Effective call for this run of pdfjam:
          /usr/bin/pdfjam --angle '180' --outfile /dev/stdout -- /dev/stdin 1,8,7,6 
  pdfjam: Calling /usr/bin/pdflatex...
  pdfjam: Finished.  Output was written to '/dev/stdout'.
          ----
  pdfjam: This is pdfjam version 3.03.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: Effective call for this run of pdfjam:
          /usr/bin/pdfjam --nup '4x2' --landscape --frame 'true' -- 8.pdf 2-5 /dev/stdin - 
  pdfjam: Calling /usr/bin/pdflatex...
  pdfjam ERROR: --outfile cannot be a directory when input is stdin

pdfjam uses `locale -k` which is not portable.

Hi,

pdfjam uses locale -k to try to guess the default paper size, however locale -k isn't portable.

On my OpenBSD system:

$ locale -k
locale: unknown option -- k
usage: locale [-a | -m | charmap]

If we drop -k then we get some locale-related stuff, but nothing to do with paper:

$ locale
LANG=
LC_COLLATE="C"
LC_CTYPE=en_US.UTF-8
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_MESSAGES="C"
LC_ALL=

A quick fix is to skip guessing the paper size on OpenBSD, but I wonder if there's a better way?

Thanks

Can't align content vertically top instead of vertically center of the page

While running:
pdfjam --outfile output.pdf --paper a4paper --landscape input.pdf

This generates output pdf where I have content at the center (vertically+horizontally) of the page. However I'm looking to have the content center only horizontally, but keep them vertically at the top.

Can't find any configuration options at --help documentation. Can it be done?

Preserve PDF annotations

Is there any way to preserve annotations to a PDF? Currently, after running a file through pdfjam, all annotations are lost

pdfjam needs a new maintainer

The pdfjam project is now orphaned.

The issue is that I am not a professional programmer, and I have neither the skill nor the time to maintain the pdfjam script (and its associated documentation) any longer.

I apologise here to those who have contributed issues and/or pull requests that are unresolved, still. I am truly grateful for those contributions. But I simply cannot continue to be the person responsible for fixing/reviewing/merging or whatever it takes to fix things and republish (e.g., to TeX Live).

Some of the issues reported relate to portability between operating systems. Others are suggestions or requests for new features. I find it hard to judge which of these things are important (because pdfjam works fine for me, on my system and for the things I want it to do!). And my experience is that adding capabilities requested by one user will typically break something (unexpectedly, to me) for another user --- which must surely count as evidence of my lack of skill in programming!

The frequency of issue reports is not high (around 30 in the last year I think). The project is GPL. I hope it continues to be useful. If someone else wants to maintain it (and even develop it?) I would be pleased about that. For now, though, the pdfjam package (here on GitHub, and also in TeX Live) has no maintainer.

Two shellcheck issues

Shellcheck -- @koalaman -- reports two types of issues with pdfjam:

Running shellcheck /Library/TeX/texbin/pdfjam provides the full context:

/Library/TeX/texbin/pdfjam:306:47: error: Multiple redirections compete for stdout. Use cat, tee, or pass filenames instead. [SC2261]
/Library/TeX/texbin/pdfjam:306:58: error: Multiple redirections compete for stdout. Use cat, tee, or pass filenames instead. [SC2261]
/Library/TeX/texbin/pdfjam:313:47: error: Multiple redirections compete for stdout. Use cat, tee, or pass filenames instead. [SC2261]
/Library/TeX/texbin/pdfjam:313:58: error: Multiple redirections compete for stdout. Use cat, tee, or pass filenames instead. [SC2261]
/Library/TeX/texbin/pdfjam:960:24: note: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line. [SC1004]
/Library/TeX/texbin/pdfjam:963:24: note: This backslash+linefeed is literal. Break outside single quotes if you just want to break the line. [SC1004]

pdfjam README file needs tidying after transfer to new maintainer

The README contains various links to URLs owned by me as the previous maintainer. Most of those links seem not to be broken (but their label-text ought to be fixed, still), because github has made suitable redirects.

An exception is the link to https://davidfirth.github.io/pdfjam, which appears in 2 places in the README I think. That link is now broken (gives error 404). So either @rrthomas can arrange for the gh.pages branch to served as a website as it was before; or we could think of some other way to fix this.

Merging more than 64 files fails

Hello,

I'm trying to merge around 300 single page PDFs into a single file. I used the following command

pdfjam *.pdf --nup '2x1' --landscape --outfile merged.pdf --no-tidy

This fails with a The call to /home/username/bin/pdflatex resulted in an error.

The last line in the log file reads: !pdfTeX error: pdflatex (file /var/tmp/pdfjam-bg2gZJ/source-64.pdf): reading im age file failed ==> Fatal error occurred, no output PDF file produced!

Inspecting the temporary PDF file shows it is empty, as are all the temporary files whose index is greater than 64. I'm using the most recently released version of pdfjam on Ubuntu 19.10 (copied the binary directly from here). I could also observe this behaviour with version 2.08 that is shipped in the texlive-utils.

Is this some known limitation or possibly just some variable that overflows? Thanks for looking into this.

[BUG] in 3.03 --keepinfo option fails to keep pdfinfo (title, subject, keywords, author)

The option --keepinfo fails to keep pdfinfo (title, subject, keywords, author)

Rewritten to clarify the points :)

Expected

  • pdfinfo (title, subject, keywords, author) should be kept.

Problems

  • Title will be lost.
  • Subject, Keywords, and Author will get extra strings.
  • Some symbols like き[#$%^&_{}~] will be lost or broken.

How to reproduce

  1. Prepare pdfjam at 9664dd9 and sample.pdf
  2. Running
    pdfjam --keepinfo sample.pdf
    
    produces sample-pdfjam.pdf.
    Note that an error pdfjam: sed s/^Title:\\\s\*//: not found occurs.
  3. Checking these PDFs by pdfinfo results in:
    $ pdfinfo sample.pdf
    Title:          X1き[#$%^&_{}~] Sample Title [#$%^&_{}~]1X
    Subject:        X2え[#$%^&_{}~] Test Subject [#$%^&_{}~]2X
    Keywords:       X3る[#$%^&_{}~] Smugged Keywords [#$%^&_{}~]3X
    Author:         X4よ[#$%^&_{}~] Kitchen Author [#$%^&_{}~]4X
    Creator:        Alternative Creator
    Producer:       dvipdfmx (20170318)
    CreationDate:   Mon May 18 17:26:09 2020 JST
    Tagged:         no
    UserProperties: no
    Suspects:       no
    Form:           none
    JavaScript:     no
    Pages:          1
    Encrypted:      no
    Page size:      419.53 x 595.28 pts
    Page rot:       0
    File size:      4009 bytes
    Optimized:      no
    PDF version:    1.5
    
    $ pdfinfo sample-pdfjam.pdf
    Title:
    Subject:        Subject: X2[&&&&&&&&&] Test Subject [&&&&&&&&&]2X
    Keywords:       Keywords: X3[&&&&&&&&&] Smugged Keywords [&&&&&&&&&]3X
    Author:         Author: X4[&&&&&&&&&] Kitchen Author [&&&&&&&&&]4X
    Creator:        LaTeX with hyperref package
    Producer:       pdfTeX-1.40.18
    CreationDate:   Mon May 18 17:26:18 2020 JST
    ModDate:        Mon May 18 17:26:18 2020 JST
    Tagged:         no
    UserProperties: no
    Suspects:       no
    Form:           none
    JavaScript:     no
    Pages:          1
    Encrypted:      no
    Page size:      595.276 x 841.89 pts (A4)
    Page rot:       0
    File size:      28088 bytes
    Optimized:      no
    PDF version:    1.5
    
    $
    

Insufficient/non-intuitive documentation for basic tasks

Hi,

I wanted to use pdfjoin after a while of not having to, and run into some obstacles. So how do I do it? Not clear. pdfjoin is mentioned at some location but is now considered replaced. By what? Not clear.
Tried the manpage? Worthless, refers to program help only. Ok, where?

pdfjam -h | grep join

-> NO information. How do I join them? This should be mentioned in the help.

So, trying a blind guess:

pdfjam input_*.pdf

Resulted in a PDF file, yes. But I found out that I need to rotate one of the inputs. How to do it?

pdfjam -h | less

There is no --rotate option or similar. Just something mentioning a suffix -rotate.

pdfjam -> ctan

Hi Reuben - any chance of uploading pdfjam release to ctan? else i guess they should remove their stale version ... thanks.

Support heterogenous landscape/portrait PDFs

Hi - first your script ROCKS! So good!
I'm trying to put all my tax statements in one, 99% of them are vertical and a few are portrait.
If I merge together homogeneous PDFs, all good, but if I merge both styles the final PDF becomes portrait for all pages.
Now I have a Music sheet PDF somewhere where pages are some verticals and some horizontal - I thought it was horrible but now it's what I would desire.
Is there a way to set the flags to get a single PDFs with some pages in vertical and some in horizontal? I've tried these flags with no luck:

  • --rotateoversize false
  • --no-landscape
  • --fitpaper 'true'

Failure on cygwin

Now pdfjam fails on cygwin (texlive-collection-binextra-20200406-1).

Unnecessary path conversion by 'cygpath -w' causes an error.

Here is a log file from pdflatex invoked by pdfjam.

texput.log

This might be related with the issue #3.

Default paper size may not be needed?

Jonathan (by email, see below) suggests to use locale to determine default paper size, rather than assuming A4. This seems a good idea, but I have no idea how robust or portable it would be. I would welcome any comments.

I have made it easy anyway with pdfjam to specify the default paper size (via pdfjam.conf), and to change the size on the fly. So this does not seem to be high priority work, for me anyway.


Date: Mon, 16 Nov 2015 17:40:46 -0500
From: Jonathan
To: "Firth, David"
Subject: Re: pdfjam default paper size from locale?

On Linux, at least, "locale -k LC_PAPER" will tell you the width and height
(in millimeters) of the locale's default paper size. For me:

$ locale -k LC_PAPER
height=279
width=216
paper-codeset="UTF-8"
$ dc

In comparison, for Brits:

$ LC_ALL=en_GB.utf-8 locale -k LC_PAPER
height=297
width=210
paper-codeset="UTF-8"
$

You could try that (if the user hasn't explicitly set the paper size) and fall
back on A4 if it doesn't work.


Is it possible to add an option to combine pdfs of different sizes?

I have 3 pages - all 250mm high. But the middle page is a spine - 10mm. The left and right pages are 300mm wide.

At the moment, pdfjam takes the 1st page, and makes every other logical page the same size. So my spine has a massive gap to the right.

Is there an option to simple combine the pdfs as they are found? I have messed around with the delta option but this applies the same delta to every page.

Run pdflatex a given number of times?

I need to examine and test the patch sent by Ferdinand (by email as below). This seems a good idea in principle.

----- Forwarded message from Ferdinand -----

Date: Thu, 19 May 2016 17:29:12 +0100
From: Ferdinand
To: David
Subject: PDFjam patch: run pdflatex a given number of times

Dear David,

first of all, thank you for your extremely useful PDFjam scripts - I use them almost daily. I've attached a little patch for telling pdfjam how many times to run pdflatex on a file. I needed this recently for adding a "Page # of #" style header using the lastpage package and I guess there could be further applications. Hope you'll find it useful.

Kind regards,
Ferdinand

Add a configure script to the package?

I would like to arrange things in the pdfjam source repository so that people can just do the usual

./configure
make
make install

to make pdfjam available on their own computer. But I don't know how best to go about setting this up. (I am not a programmer.) I would appreciate any offer of help with this.

Help text does not contain default configuration values

The following output is from pdfjam --help:

pdfjam is a shell-script front end to the LaTeX 'pdfpages' package (for
which, see http://www.ctan.org/tex-archive/macros/latex/contrib/pdfpages).

Usage: pdfjam [OPTIONS] [--] [FILE1 [SEL1]] [FILE2 [SEL2]]...

[...]
     --suffix STRING
                  Specifies a suffix for output file names, to be used when
                  --outfile is either (a) a directory, or
                                      (b) not specified in a --batch call.
                  A good STRING should be descriptive: for example,
                           --suffix 'rotated'
                  would append the text '-rotated' to the name of the input
                  file in order to make the output file name, as in
                  'myfile-rotated.pdf'.  The STRING must not have zero
                  length.
                  [Default for you at this site: suffix=]
[...]

All the "Default for you at this site:" section is missing the default configuration value even if those are set. It is because the $helptext variable is placed before setting their values up. It is a regression since the order is correct in v2.08.

Error on pdfjam: "tty is connected to connected to stdin, no PDF/JPG/PNG file found"

I'm trying to rotate a PDF using the command

pdfjam --landscape --angle==270 test.pdf

but I get the following:


  pdfjam: This is pdfjam version 3.03.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: No PDF/JPG/PNG source specified: input is from stdin.
  pdfjam: Effective call for this run of pdfjam:
          /usr/bin/pdfjam --landscape --angle==270 'test.pdf' -- /dev/stdin - 
  pdfjam ERROR: tty is connected to connected to stdin, no PDF/JPG/PNG file found

Problem occurs even if file test.pdf does not exist in folder.

I cannot find a similar problem online. I'm running Ubuntu 20.04. Any ideas?

PD: is there a typo in the error message? (repeated "connected to")

pdfpages link possibility messed up

pdfpages link possibility gets messed up, if using more than one input file, through pdfjams method of passing full paths in the generated .tex file.
If pdfjam would use \includepdfmerge[link=true]{source-1.pdf,-,source-2.pdf,-} in the resulting TeX file, instead of full temporary pathes like \includepdfmerge[link=true]{/tmp/pdfjam-b8ERTD/source-1.pdf,-,/tmp/pdfjam-b8ERTD/source-2.pdf,-} the users had the possibility to link to the pdf pages from the outside.
e.g. with LaTeX command \href{file:/my/local/merged.pdf#source-1.pdf.1}{merged.pdf} and \href{file:/my/local/merged.pdf#source-2.pdf.1}{merged.pdf} one could link to pages 1 of source file 1 and source file 2. But with the existing pdfjam method, one can only link safely to the first file, through an additional parameter --linkname myfooname and \href{file:/my/local/merged.pdf#myfooname.1}{merged.pdf} but you can not link to page 1 of the second file, because the link target has the same name as the first one (you can not link to page 51, to reach page 1 of the second document, when the first has 50 pages, myfooname.51 would not exist (if no single document is longer than 50 pages), myfooname.1 would point to first document).
Using relative paths would leave a workaround via the known source file names, which are not known if pdfjam uses the full temporary path.
(pdfjam 3.03)

Option to respect original paper size (for eg. beamer)

Hello,

I have to extract the beginning of a PDF created with beamer, which has a non-standard "paper" size.

It does not seem easy to do with pdfjam : it seems I would need to check what that format is and specify it manually.

Is there a better way ?

Requested functionality: step and repeat

Hello,

Maybe I am missing the options to do it, but I've been browsing the documentations and examples for a while, and I can't figure it out.

I'd like to be able to output two copies of a PDF's pages, side by side, into a new, 2x sized document. Ideally, I'd be able to tell the script 2x1 or 1x2, and it'd calculate the output page size as necessary.

Please notice that I don't want page1+page2, page3+page4... in the same sheet of paper, but page1+page1, page2+page2...

I believe this action is typically called «step and repeat» in some PDF manipulation tools, so maybe (if the functionality is missing) adding a --step NxM switch to pdfjam would be a good approach.

If this is possible with the current PDFjam options -- could you please direct me to documentation, or instruct me on how to do it?

TeX Live and dependencies

Matthias has kindly alerted me to the fact that it is possible to install pdfjam via TeX Live but to then have some dependencies missing from your installation. (The example given by Matthias was that pdflscape.sty was missing from his installation and that caused an error when running pdfjam.)

I do not know enough about TeX Live to be able to solve this (and regrettably I have no time to find out). Matthias kindly pointed me to information at https://tug.org/texlive/pkgcontrib.html#deps, but it seems (from that information) that CTAN's administrators "do not particularly recommend" doing what is described there.

If somebody else knows how to fix this (including tracking reliably all of the dependencies!) then of course that would be good. I suppose that a simple solution could be just to remove pdfjam from TeX Live?

PDF inclusion: invalid ProcSet array type <dictionary>

I have a PDF document with two pages scanned with XSane:

> identify foo.pdf
foo.pdf[0] PDF 241x155 241x155+0+0 16-bit sRGB 95485B 0.000u 0:00.000
foo.pdf[1] PDF 242x155 242x155+0+0 16-bit sRGB 95135B 0.000u 0:00.001

Any sort of processing with pdfjam result in an error:

> pdfjam --no-tidy --paper letter --outfile 1.pdf -- foo.pdf
          ----
  pdfjam: This is pdfjam version 3.03.
  pdfjam: Reading any site-wide or user-specific defaults...
          (none found)
  pdfjam: Temporary directory for this job is
                    /var/tmp/pdfjam-WxYPgt
  pdfjam: Effective call for this run of pdfjam:
          /usr/bin/pdfjam --no-tidy --paper letter --outfile 1.pdf -- foo.pdf - 
  pdfjam: Calling /usr/bin/pdflatex...
  pdfjam: FAILED.
          The call to /usr/bin/pdflatex resulted in an error.
          If '--no-tidy' was used, you can examine the
          log file at
                  /var/tmp/pdfjam-WxYPgt/a.log
          to try to diagnose the problem.
  pdfjam ERROR: Run 1: Output file not written

I have multiple PDFs like this with the same page count and dimensions and they all fail. Other files from Xsane work fine.

Extra info:

> pdfjam --version
3.03
> dnf info texlive-pdfjam
Installed Packages
Name         : texlive-pdfjam
Epoch        : 9
Version      : 20200327
Release      : 30.fc34
Architecture : noarch
Size         : 184 k
Source       : texlive-base-20200327-30.fc34.src.rpm
Log file

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (TeX Live 2020) (preloaded format=pdflatex 2020.11.24)  20 OCT 2021 22:01
entering extended mode
 restricted \write18 enabled.
 %&-line parsing enabled.
**/var/tmp/pdfjam-deeQuV/a.tex
(/var/tmp/pdfjam-deeQuV/a.tex
LaTeX2e <2020-02-02> patch level 5
L3 programming layer <2020-04-06>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size10.clo
File: size10.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count167
\c@section=\count168
\c@subsection=\count169
\c@subsubsection=\count170
\c@paragraph=\count171
\c@subparagraph=\count172
\c@figure=\count173
\c@table=\count174
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen134
) (/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks15
\inpenc@posthook=\toks16
) (/usr/share/texlive/texmf-dist/tex/latex/pdfpages/pdfpages.sty
Package: pdfpages 2020/01/28 v0.5q Insert pages of external PDF documents (AM)
(/usr/share/texlive/texmf-dist/tex/latex/base/ifthen.sty
Package: ifthen 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
) (/usr/share/texlive/texmf-dist/tex/latex/tools/calc.sty
Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
\calc@Acount=\count175
\calc@Bcount=\count176
\calc@Adimen=\dimen135
\calc@Bdimen=\dimen136
\calc@Askip=\skip49
\calc@Bskip=\skip50
LaTeX Info: Redefining \setlength on input line 80.
LaTeX Info: Redefining \addtolength on input line 81.
\calc@Ccount=\count177
\calc@Cskip=\skip51
) (/usr/share/texlive/texmf-dist/tex/latex/eso-pic/eso-pic.sty
Package: eso-pic 2018/04/12 v2.0h eso-pic (RN)
(/usr/share/texlive/texmf-dist/tex/generic/atbegshi/atbegshi.sty
Package: atbegshi 2019/12/05 v1.19 At begin shipout hook (HO)
(/usr/share/texlive/texmf-dist/tex/generic/infwarerr/infwarerr.sty
Package: infwarerr 2019/12/03 v1.5 Providing info/warning/error messages (HO)
) (/usr/share/texlive/texmf-dist/tex/generic/ltxcmds/ltxcmds.sty
Package: ltxcmds 2019/12/15 v1.24 LaTeX kernel commands for general use (HO)
) (/usr/share/texlive/texmf-dist/tex/generic/iftex/iftex.sty
Package: iftex 2020/03/06 v1.0d TeX engine tests
)) (/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks17
) (/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
)) (/usr/share/texlive/texmf-dist/tex/latex/graphics/graphicx.sty
Package: graphicx 2019/11/30 v1.2a Enhanced LaTeX Graphics (DPC,SPQR)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/graphics.sty
Package: graphics 2019/11/30 v1.4a Standard LaTeX Graphics (DPC,SPQR)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/trig.sty
Package: trig 2016/01/03 v1.10 sin cos tan (DPC)
) (/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/graphics.cfg
File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
)
Package graphics Info: Driver file: pdftex.def on input line 105.
)
\Gin@req@height=\dimen137
\Gin@req@width=\dimen138
)
\AM@pagewidth=\dimen139
\AM@pageheight=\dimen140
(/usr/share/texlive/texmf-dist/tex/latex/pdfpages/pppdftex.def
File: pppdftex.def 2020/01/28 v0.5q Pdfpages driver for pdfTeX (AM)
)
\AM@pagebox=\box45
\AM@global@opts=\toks18
\AM@pagecnt=\count178
\AM@toc@title=\toks19
\c@AM@survey=\count179
\AM@templatesizebox=\box46
) (/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
File: l3backend-pdfmode.def 2020-03-12 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count180
\l__pdf_internal_box=\box47
)

LaTeX Warning: Unused global option(s):
    [letter].

No file a.aux.
\openout1 = `a.aux'.

LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 6.
LaTeX Font Info:    ... okay on input line 6.
\AtBeginShipoutBox=\box48
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count181
\scratchdimen=\dimen141
\scratchbox=\box49
\nofMPsegments=\count182
\nofMParguments=\count183
\everyMPshowfont=\toks20
\MPscratchCnt=\count184
\MPscratchDim=\dimen142
\MPnumerator=\count185
\makeMPintoPDFobject=\count186
\everyMPtoPDFconversion=\toks21
) (/usr/share/texlive/texmf-dist/tex/latex/epstopdf-pkg/epstopdf-base.sty
Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
85.
(/usr/share/texlive/texmf-dist/tex/latex/latexconfig/epstopdf-sys.cfg
File: epstopdf-sys.cfg 2010/07/13 v1.3 Configuration of (r)epstopdf for TeX Liv
e
)) (/usr/share/texlive/texmf-dist/tex/latex/pdflscape/pdflscape.sty
Package: pdflscape 2019/12/05 v0.12 Display of landscape pages in PDF (HO)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/lscape.sty
Package: lscape 2000/10/22 v3.01 Landscape Pages (DPC)
)
Package pdflscape Info: Auto-detected driver: pdftex on input line 81.
)
</var/tmp/pdfjam-deeQuV/source-1.pdf, id=1, 241.90375pt x 153.57375pt>
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf  used on input lin
e 7.
(pdftex.def)             Requested size: 241.90315pt x 153.57336pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf  used on input lin
e 7.
(pdftex.def)             Requested size: 241.90315pt x 153.57336pt.
</var/tmp/pdfjam-deeQuV/source-1.pdf, id=4, page=1, 241.90375pt x 153.57375pt>
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 241.90315pt x 153.57336pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
File: /var/tmp/pdfjam-deeQuV/source-1.pdf Graphic file (type pdf)
<use /var/tmp/pdfjam-deeQuV/source-1.pdf, page 1>
Package pdftex.def Info: /var/tmp/pdfjam-deeQuV/source-1.pdf , page1 used on in
put line 7.
(pdftex.def)             Requested size: 313.20139pt x 198.83739pt.
[1

 </var/tmp/pdfjam-deeQuV/source-1.pdf
!pdfTeX error: /usr/bin/pdflatex (file /var/tmp/pdfjam-deeQuV/source-1.pdf): PD
F inclusion: invalid ProcSet array type <dictionary>
 ==> Fatal error occurred, no output PDF file produced!
\```

</p>
</details>

Allow other back-ends such as lualatex or xelatex

The main suggested improvement from an email exchange with Mircea is to add a command-line switch like

--latex blah

where blah can be 'pdflatex' or 'lualatex' or the full path to one of the other flavours that are currently supported by pdfpages. Should be easy enough for lualatex or xelatex, I think.

Might need to think about how this interacts with the config file; but it should just behave like other entries there, ie be superseded by the --latex switch in the command line (or maybe pick a more coherent name than --latex?)

can pdfjam re-order the pages for simple imposition and n-up print compositing?

If we're printing a many-page document it's quite possible we need to re-order the pages... the way https://wiki.scribus.net/canvas/Making_a_booklet_with_Scribus_and_Adobe_Reader describes (for the Scribus desktop publishing software of course)... so for example

A 16-page booklet would print onto 4 sheets of paper:
sheet 1 front: pages 16,1
sheet 1 back: pages 2,15
sheet 2 front: pages 14,3
sheet 2 back: pages 4,13
sheet 3 front: pages 12,5
sheet 3 back: pages 6,11
sheet 4 front: pages 10,7
sheet 4 back: pages 8,9

This booklet form is for laying all the sheets flat on each other and folding them all at once together.

If we want more pages than can be folded this way (as in a book) we might need to fold each sheet individually, which would give us a page order like:
sheet 1 front: pages 4,1
sheet 1 back: pages 2,3
sheet 2 front: pages 8,5
sheet 2 back: pages 6,7
sheet 3 front: pages 12,9
sheet 3 back: pages 10,11
sheet 4 front: pages 16,13
sheet 4 back: pages 14,15
sheet 5 - 200 or more etc would follow this pattern.

Can pdfjam do ordering like this? (If not, do you happen to know a command line tool which can?)

Arrange output --nup by columns

Hi David and/or collaborators,

First of all I want to say that I found this great tool very recently and I love it! Still a lot to explore with but is working well so far for what I need: imposing pdf figures in a grid.

Maybe I missed something but I would like to arrange my plots with the --nup option by column instead of rows.
I saw this great answer online [https://superuser.com/questions/1075676/merge-glue-exported-pdf-from-spreadsheet-application] but while running the --column true option I get and error. Besides, there is not reference in the readme nor in the pdfjam help.

Is this option implemented? if not would be a great to have it.

Thanks for you help.
Niko

"too many open files"

Email below from George reports the problem. I would welcome any comments on this, before I spend any time implementing and testing it. (It won't be easy for me to test, as I have never myself run into the problem that is reported.)

My immediate idea is to include an additional, optional command-line switch, "--immediate", to insert those two lines if desired. And then add a note to the FAQ?

I think I found the source of the suggestion sent by George, here: https://tug.org/pipermail/pdftex/2008-March/007559.html

On 2019-10-01 at 22:28, George wrote:

Hi there,

The doc for pdfjam says to report bugs to this address. I have found what I
consider a bug in pdfjoin: namely, pdfjoin fails if you give it more than
249 input files.

Here is the relevant part of the error message:

pdflatex: /var/tmp/pdfjam-CrZdU7/source-249.pdf: Too many open files

I have not looked at the internals of pdfjam, but from experience I know
that LaTeX fails if you try to include more then about this number of files
with pdfpages.

The fix is to put the following at the top of your LaTeX source file, before
the \documentclass statement.

\let\mypdfximage\pdfximage
\def\pdfximage{\immediate\mypdfximage}

Doing this seems to get around the restriction. I hope you could add this
to pdfjam so that it is not limited in the number of files to be joined.

I should admit that I did not invent this solution, but found it with some
googling once many years ago. I am ashamed that I have forgotten who to
credit.

Best,

--George

Preserve PDF annotations by using pax?

Suggestion received as below. I have not looked into it. If someone wanted to investigate, implement, check everything and make a minimal patch for pdfjam, then it could be a good addition I think.

----- Forwarded message from Alexander -----

Date: Fri, 27 Jan 2017 14:24:18 +0100
From: Alexander
To: David Firth
Subject: PDFjam suggestion: keep annotations using pax

Hi David,

thanks a ton for the incredibly useful PDFjam tool.

I have a small suggestion for it: as you state yourself, a "potential drawback of pdfjam and other scripts based upon it is that any hyperlinks in the source PDF are lost." Heiko Oberdiek wrote an (experimental, but AFAICS quite reliable) combination of an annotation extractor and a corresponding LaTeX package to reintegrate them: pax 1.

Its usage is fairly simple if properly installed: before the run of pdflatex on the temporary file containing the pdfpages commands, run pdfannotextractor --install # only on first run
for infile in source-*.pdf; do
pdfannotextractor $infile
done
and add an
\include{pax}
after
\include{pdfpages}
in the temporary texfile. Afterwards, compile (twice?) and enjoy preserved hyperlinks. Unfortunately, bookmarks are still lost as of yet, but at least the links and destinations are there. Also, pax is aware of geometry changes, so anchor positions are adjusted if pages are rescaled.

The above approach works out-of-the-box on my Arch Linux installation with current TeXLive. And it seems to be reasonably easy to integrate, so even if pax is not easily available for everyone, it might be worth to have a look.

Thanks again for your tool!
Alexander

----- End forwarded message -----

I'm so confused with a use but not exist in documentation

I'm so confused with the use of option:
--noautoscale

I keep using it as it works great, fit in my need, that since one taught me to use it but.. it's not existing in documentation at all !

$ pdfjam --help| grep noautoscale

Please help clarify on this as clearly as possible

Request for info: Exclude pages counting from last

I have the need to exclude the page before last from a PDF document where I have no prior knowledge of the total number of pages.
I see from pdfpages that you can refer last page as last but unfortunately no arithmetic support is provided, i.e. last-1 will include all the pages in reverse order.

Any hints/suggestions are very welcome.

unknown keyword LC_PAPER

pdfjam 3.03 reports on the first line of output:

unknown keyword LC_PAPER

This is perhaps a missing environment variable that is not set in MacTex Live 2021, running under macOS 10.13.6. This sounds like a portability issue. The code in questions appears to be:

if command -v locale >/dev/null ; then paperheight=$(locale -k LC_PAPER | sed -e '1!d' -e 's/.*=//') ;

I cannot find anything on how Tex interacts (if at all) with environment variables. Paper size is apparently extracted with tlmg paper, but that lists the default for a variety of binaries. If we only want to look at pdftex then we can extract that papersize with tlmgr pdftex paper

Current pdftex paper size (from /usr/local/texlive/2021/texmf-config/tex/generic/tex-ini-files/pdftexconfig.tex): a4

FYI, /etc/papersize does not appear to exist on macOS.

Feature request: allow shortedge rotation of pages from pdfjam

Hi!

There is a pretty good workaround to get pages odd pages 180 degrees when making signatures, by using: pdfjam --preamble '\usepackage{everyshi}\makeatletter\EveryShipout{\ifodd\c@page\pdfpageattr{/Rotate 180}\fi}\makeatother' (don't worry, I'm not smart, I've took this from https://github.com/jenom/pdfbook2/blob/master/pdfbook2/pdfbook2#L153). The issue is that this is a clunky workaround, especially since it rely on everyshi.sty, which I don't know what that is, but I know there should be a check for it in code.

Is this some oddball feature that nobody uses? Should I just go ahead and implement? Are there plans to migrate this code to python?

Obey TMPDIR variable

In Debian we have a patch to obey the variable TMPDIR, if it is set. Consider to apply it to your code. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.