pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "BREMAUD, CYRIL" <cyril.brem...@atos.net>
Subject RE: Starting question about PDFBox
Date Tue, 12 Apr 2016 12:56:57 GMT
You can find many example with PDFBox 2.0.0 at this link : https://svn.apache.org/viewvc/pdfbox/trunk/examples/src/main/java/org/apache/pdfbox/examples/


-----Original Message-----
From: Macamba [mailto:macamba@hermod.nl] 
Sent: Tuesday, April 12, 2016 2:15 PM
To: users@pdfbox.apache.org
Subject: Starting question about PDFBox



My apologies for this basic question, but I'm just starting with PDFBox and can't make heads
nor tale from it (at the moment). I found a website
(http://radixcode.com/category/pdfbox/) which had example code I wanted to start out with.
But when I copied the first code into Eclipse my Eclipse complained about some of the imports.
I have included the example code below my text. 


As I start with PDFBox I need some documentation to help me start. As I use PDFBox 2.0.0 I
cannot find any examples. Does anyone know of websites with some explanation? Or would it
be smarter to use PDFBox 1.8.11 (which also has no example of a working example as far as
I could see)?





Example code from http://radixcode.com/category/pdfbox/ 


import java.io.FileInputStream;

import org.apache.pdfbox.pdmodel.PDDocument;

import org.apache.pdfbox.pdmodel.PDPage;

import org.apache.pdfbox.pdmodel.edit.PDPageContentStream;

// The following import org.apache.pdfbox.pdmodel.graphics.xobject cannot be resolved

import org.apache.pdfbox.pdmodel.graphics.xobject.PDJpeg;

// The following import org.apache.pdfbox.pdmodel.graphics.xobject cannot be resolved

import org.apache.pdfbox.pdmodel.graphics.xobject.PDXObjectImage;




* @author azeem



public class Main {


    public static void main(String[] args) {


        String fileName = "pdfWithImage.pdf";

        String imageName = "Logo.jpg";


        try {


            PDDocument doc = new PDDocument();

            PDPage page = new PDPage();




            PDXObjectImage image = new PDJpeg(doc, new FileInputStream(imageName));


            PDPageContentStream content = new PDPageContentStream(doc, page);


            content.drawImage(image, 180, 700);








        } catch (Exception e) {






To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org

View raw message