473,386 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Appending pdf documents into one

Here is what I am trying to do:
Open a.pdf, append b.pdf to it and save the aggregate as
c.pdf.
I want to do it through a program written in .net. I would like to do this
without using any tools or thirdparty components.
What i am trying out is getting the byte stream of the both the documents
and then merging the stream and getting one stream.

Any quick help will be appreciated.

Ganesh

Nov 19 '05 #1
2 1217
Don't know if you can do this by simply appending one stream to the
other. I believe there are headers and other elements in the PDF that
cannot be combined like this. There is a free library called pdflib
that could probably do it for you.

Nov 19 '05 #2
Appending byte streams together definitely will not work. PDF documents have
a header and a trailer, for one, that is singular to the whole document, so
concatenating two files together immediately violates this requirement. The
atomic pieces of a PDF document are called objects and they are uniquely and
sequentially numbered, such that the trailer of the PDF file refers to the
physical position within the file (ie. from offset 0) of each such object.

Clearly this structure is not going to work merely by concatenation. I'm
sure you could write a .NET class to do the merging, but it will be
extremely difficult. You will need to parse the files, read all the objects
into [probably] memory, find all the object references (objects can
reference other objects), then resequence all the objects so they have
unique numbers, and finally rewrite a new file. Because objects reference
other objects, you need to "understand" the structure of these objects in
order to identify the object references, and there are an incredible number
of different object types.

There are several products that will do PDF file merging - unless you have
weeks to months spare to roll your own, you might find an off-the-shelf
product that will do the job. PDFlib is one but from memory it is
horrendously expensive - I have seen other products which perhaps don't
necessarily offer the same capabilities but are virtually an order of
magnitude cheaper.

Kevin

"Ganesh" <Ga****@discussions.microsoft.com> wrote in message
news:AB**********************************@microsof t.com...
Here is what I am trying to do:
Open a.pdf, append b.pdf to it and save the aggregate as
c.pdf.
I want to do it through a program written in .net. I would like to do this
without using any tools or thirdparty components.
What i am trying out is getting the byte stream of the both the documents
and then merging the stream and getting one stream.

Any quick help will be appreciated.

Ganesh

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: MLH | last post by:
I have a query, qryAppend30DayOld260ies that attempts to append records to tblCorrespondence. When run, it can result in any of the following: appending no records, appending 1 record or appending...
2
by: Shaurya Vardhan | last post by:
Hi, On Appending a child in XML Node, I am having error, "Run-time exception thrown : System.ArgumentException - The node to be inserted is from a different document context." How to resolve...
4
by: John A Grandy | last post by:
could someone explain the following to me : Appending the literal type character I to a literal forces it to the Integer data type. Appending the identifier type character % to any identifier...
3
by: delraydog | last post by:
I'm writing a reusable JavaScript library which needs to set certain styles in a document. The document may have an existing stylesheet definition either by a link or by an existing stylesheet...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.