Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Merging the pdf files together in java

Posted on 2004-09-07
11
Medium Priority
?
665 Views
Last Modified: 2012-06-27
Hello experts,...

big task for me .. and seems difficult too.... but i am sure i will get the answers and suggestions here... and i am sure u won't let me down.......

My task is to merge all the voucher files and make one pdf file...

i explain the problem in brief....  we have vouchers for a particular transactions .. all these vouchers are scanned by an application .. on a scanner.. so we get different different 4-5 pdf files for all the vouchers for a particular transaction only... now we need to show one pdf ... means merge all those scanned vouchers pdf file into one ... and make that viewable to the client ...

the task would have been more easy if the development server environment was windows ... but we have sun solaris .. so i cannot run an vb program to merge the pdf files...

secondly i cannot enforce the scanning to merge all the pdf files ...as sometimes we receive some vouchers late .. and some of them are previously scanned... and some will be scanned later... so the activity has a specific time when to merge all the pdf files..

so i would rather make a scheduler to check for the status of transaction .. and then merge the files... so it should be a java program to merge the files....

the environment where i am suppose to do is ... jdk1.3 with weblogic 7.0 as application server. .. and sunsolaris is the O/S...

Awaiting for the answer at the earliest

it seems to be a difficult task for me ... so i am rating the question accordingly

vijay
0
Comment
Question by:JavaGuru2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 92

Expert Comment

by:objects
ID: 11994654
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11994788
0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11994804

http://multivalent.sourceforge.net/

This tool is command line tool. But as it is open source you can change according to ur requirements
http://multivalent.sourceforge.net/Tools/pdf/Merge.html

Regards
Sudhakar
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:JavaGuru2003
ID: 11999324
Hello,

i want java api which i can use and make a java program with a function to append... i don't need tool to append pdf . i want java program... a api to work with pdf so that i can append them in the program..

0
 
LVL 14

Expert Comment

by:sudhakar_koundinya
ID: 11999367
Hello JavaGuru,  Multivalent is Open Source API only.

That tool was created as a part of API only. If you don't want to use that

you can directly use the API itself best regards
Sudhakar
0
 
LVL 92

Expert Comment

by:objects
ID: 12002204
Try the PDFAppender class in PJX

http://pjx.sourceforge.net/
0
 

Author Comment

by:JavaGuru2003
ID: 12005539
ver well said PDFAppender....

the constraint is i am working with jdk1.3 on weblogic server on sunsolaris and pjx is supported by j2se1.4 only .. it is written on their document ... prerequisite of using pjx... i have the code of pjx to append the files but i am getting errors for PDFAppender class.... if u want i can show u the error what i am getting

vijay
0
 

Author Comment

by:JavaGuru2003
ID: 12013615
This is the error i receive when i use PJX appender to append pdf files
The code is

            List m = new ArrayList();
            m.add(new com.etymon.pjx.PdfManager(new com.etymon.pjx.PdfReader(new com.etymon.pjx.PdfInputFile(new File("@SCANNING_ROOT_VOUCHER_SERVER@/voucher/v_1.pdf")))));
            m.add(new com.etymon.pjx.PdfManager(new com.etymon.pjx.PdfReader(new com.etymon.pjx.PdfInputFile(new File("@SCANNING_ROOT_VOUCHER_SERVER@/voucher/v_2.pdf")))));
            com.etymon.pjx.PdfWriter w = new com.etymon.pjx.PdfWriter(new File("@SCANNING_ROOT_VOUCHER_SERVER@/voucher/onetwo.pdf"));
            com.etymon.pjx.util.PdfAppender a = new com.etymon.pjx.util.PdfAppender(m,w);
            a.append();
            w.close();
            PdfWriter w = new PdfWriter(new File("out.pdf"));

The error what i get is

    [javac] bad class file: /home/vijay/beaposeidon/lib/pjx/pjx.jar(com/etymon/pjx/PdfManager.class)
    [javac] class file has wrong version 48.0, should be 47.0
    [javac] Please remove or make sure it appears in the correct subdirectory of the classpath.
    [javac]             m.add(new com.etymon.pjx.PdfManager(new com.etymon.pjx.PdfReader(new com.etymon.pjx.PdfInputFile(new File("http://192.168.0.169/voucher/v_1.pdf")))));
    [javac]                                     ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -deprecation for details.
    [javac] 1 error

0
 

Accepted Solution

by:
pjnola earned 800 total points
ID: 12033373
I recomment using the iText library (http://www.lowagie.com/iText/index.html).  It is open source (LGPL or MPL) and very capable.  The documentation includes an example of exactly what you are trying to do -- merge multiple PDFs into one.  See the source code at http://itext.sourceforge.net/src/com/lowagie/tools/concat_pdf.java
0
 

Author Comment

by:JavaGuru2003
ID: 12034132
Hello..

pjnola.. u are done .. this is what i exactly needed.... i knew to create pdf through itext.. but i was not aware we can also append two pdf using itext... anyways thanks for the comment it reduced my work ... and now its easy for me also to work with my project

thanks

vijay
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question