Append via COPY

J

JoJo

Folks:

I have 5 separate PDF files and each is about 300 KB large. I would like to
run a simple COPY
command from the command prompt in order to combine (append) these files
into a single PDF file.

The syntax of the command I used is as follows:
----------------------------------------------------------------------------
---------------------------------
COPY /B /V Part1.pdf /B + Part2.pdf /B + Part3.pdf /B + Part4.pdf /B +
Part5.pdf /B Allparts.pdf /B
----------------------------------------------------------------------------
---------------------------------

The command runs for a short time but the end result is that Allparts.pdf is
no different from part1.pdf

* Can anyone throw some light on this issue ? Why is the command not
running successfully ?


Thanks,
Jon.
 
P

Pegasus [MVP]

JoJo said:
Folks:

I have 5 separate PDF files and each is about 300 KB large. I would like
to
run a simple COPY
command from the command prompt in order to combine (append) these files
into a single PDF file.

The syntax of the command I used is as follows:
----------------------------------------------------------------------------
---------------------------------
COPY /B /V Part1.pdf /B + Part2.pdf /B + Part3.pdf /B + Part4.pdf /B
+
Part5.pdf /B Allparts.pdf /B
----------------------------------------------------------------------------
---------------------------------

The command runs for a short time but the end result is that Allparts.pdf
is
no different from part1.pdf

* Can anyone throw some light on this issue ? Why is the command not
running successfully ?


Thanks,
Jon.

The command did run successfully, which you could confirm if you compared
file sizes. However, .pdf files are binary files and not text files. They
have a header and a certain internal structure. When you join two .pdf files
in the manner you did then you're not modifying the header of the first
file. Adobe Reader therefore "thinks" that the file length is the same as
before. You're lucky that Acrobat was still able to read the file!

You will need to buy the full Adobe Acrobat product in order to manipulate
..pdf files.
 
T

Tim Meddick

Despite you using the "/b" switch, it would not work because many types of file have
far more complicated 'headers' and 'footers' than the simple start-of-file /
end-of-file characters that a simple binary file posses.

This resulted in Adobe Reader recognising the opening structure of the first file and
then it read the closing structure of the same file - and there it stopped reading.

Notwithstanding that several more files were appended to the end of your first file.

I desperately wanted to "join" two midi files together once.

I had to open them in a binary file editor and learn to recognise where the 'headers'
ended and the 'footers' began.

Then I had to delete the 'footer' of the first file and the 'header' of the second -
only then could I join them together using "copy /b".

It worked, but it did require a lot of effort on my part.

You can, however, join simple text files together with the "copy /b" command, as the
only 'headers' and 'footers' that they posses are the basic start-of-file /
end-of-file characters that the "copy /b" command is designed to strip and relocate.

=

Cheers, Tim Meddick, Peckham, London. :)
 
R

Rich Pasco

Tim said:
You can, however, join simple text files together with the "copy /b" command, as the
only 'headers' and 'footers' that they posses are the basic start-of-file /
end-of-file characters that the "copy /b" command is designed to strip and relocate.

Actually, "copy /b" doesn't strip or relocate anything. It just
concatenates the files exactly as they are.

Back in the old DOS days, it was customary to end a text file with
a Ctrl-Z character. "Copy /a" (or anything except /b) would strip off
Ctrl-Z from all the files but the last one, so that any application
which stopped reading at a Ctrl-Z would read all the files together
before stopping at the last one.

Nowadays, most applications don't use the Ctrl-Z on text files
anymore, so you don't need the /A option to concatenate them,
and /B works fine for text files without Ctrl-Z's.

- Rich
 
T

Tim Meddick

Rich,
My knowledge is seriously rooted in the past and I was, indeed, thinking that
files needed an end-of-file character (0x1A) like in the old days of DOS (where I
still live for much of the time, it seems).

I thankyou for pointing out my error and dragging me into the present-day...

==

Cheers, Tim Meddick, Peckham, London. :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top