| | |
PDF in JAVA
Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
![]() |
iText library is one of the options
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Well, only sort of. There are several writer objects in iText that allow you to import existing PDF content and generate new output content. I think that what the OP is wanting to do would be possible in iText, but I can't say from direct experience there.
Here is a bit of tutorial on manipulating existing docs with iText:
http://itextdocs.lowagie.com/tutoria....html#inaction
Here is a bit of tutorial on manipulating existing docs with iText:
http://itextdocs.lowagie.com/tutoria....html#inaction
Last edited by Ezzaral; Jul 10th, 2007 at 6:28 pm.
It realy depends on what he is trying to do. He can always insert image/new data into existing documnet and they can be writen on new layer over existing content or he can put it below like a watermark. So michael you need to be more specific with this question...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Dec 2006
Posts: 20
Reputation:
Solved Threads: 0
I managed to get it.
I had a PDF file that had about 10 pages and I wanted to insert an image on every page.
This is what I did
import com.lowagie.text.Image;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
.
. Start Class
.
.
.
private PdfReader reader=null;
private PdfStamper stamp=null;
private PdfContentByte over=null;
.
.Start function
.
reader = new PdfReader("MyPDFFile.pdf");
int NumberOfPages = reader.getNumberOfPages();
int startPageLoop = 0;
Image img;
img = Image.getInstance("C:\Images\Your_Mother.jpg");
while (startPageLoop < NumberOfPages) {
startPageLoop++;
over = stamp.getOverContent(startPageLoop);
img.setAbsolutePosition(x, y);
over.addImage(img);
}
.
.
.
.
.end function
.
Thanks for your help anyway
I had a PDF file that had about 10 pages and I wanted to insert an image on every page.
This is what I did
import com.lowagie.text.Image;
import com.lowagie.text.pdf.PdfContentByte;
import com.lowagie.text.pdf.PdfReader;
import com.lowagie.text.pdf.PdfStamper;
.
. Start Class
.
.
.
private PdfReader reader=null;
private PdfStamper stamp=null;
private PdfContentByte over=null;
.
.Start function
.
reader = new PdfReader("MyPDFFile.pdf");
int NumberOfPages = reader.getNumberOfPages();
int startPageLoop = 0;
Image img;
img = Image.getInstance("C:\Images\Your_Mother.jpg");
while (startPageLoop < NumberOfPages) {
startPageLoop++;
over = stamp.getOverContent(startPageLoop);
img.setAbsolutePosition(x, y);
over.addImage(img);
}
.
.
.
.
.end function
.
Thanks for your help anyway
![]() |
Similar Threads
- How to download a file (Java)
- Barcode printing in Java (Java)
- Generics (Java)
- How can we print an MS Word document from Java (Java)
Other Threads in the Java Forum
- Previous Thread: What is MVC pattern
- Next Thread: Need help with javax.mail api
| Thread Tools | Search this Thread |
2dgraphics android api apple applet application arguments array arrays automation banking binary binarytree bluetooth capture chat chatprogramusingobjects class classes client code color component count database derby design eclipse eclipsedevelopment encryption error exception fractal game givemetehcodez graphics gridlayout gui html ide if_statement image input integer interface j2me java javadesktopapplications javaprojects jlabel jni jpanel julia keyword linux list loop macintosh map method methods midlethttpconnection mobile netbeans newbie nullpointerexception object os print printing problem producer program programming project projectideas read recursion reference replaysolutions ria scanner screen server set size sms sort sourcelabs sql stop string swing threads transforms tree ui unicode validation windows






