pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mark Bolduc" <mark.bol...@comcast.net>
Subject RE: Dries Horions boxable PDFBox Table class
Date Wed, 01 Jul 2015 12:34:42 GMT
Thanks. 

Can you point me to where I can find published projects where people have
created more higher level functionality?

Regards
Mark Bolduc


-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Wednesday, July 01, 2015 2:40 AM
To: users@pdfbox.apache.org
Subject: Re: Dries Horions boxable PDFBox Table class

Am 01.07.2015 um 04:57 schrieb Mark Bolduc:
> Thanks, I am brand new to PDFBox,

Note that PDFBox is rather low-level compared to PDFBox. You need to do a
lot yourself. It helps to look at the PDF specification.

>
> Does anyone have a method to create a rectangle with rounded corners?

in a PDPageContentStrean use

/**
      * Set the line join style.
      * @param lineJoinStyle 0 for miter join, 1 for round join, and 2 for
bevel join.
      * @throws IOException If there is an error while writing to the
stream.
      */
     public void setLineJoinStyle(int lineJoinStyle) throws IOException

/**
      * Add a rectangle to the current path.
      *
      * @param x The lower left x coordinate.
      * @param y The lower left y coordinate.
      * @param width The width of the rectangle.
      * @param height The height of the rectangle.
      * @throws IOException If there is an error while drawing on the
screen.
      */
     public void addRect(float x, float y, float width, float height) throws
IOException


     /**
      * Stroke the path.
      *
      * @throws IOException If there is an error while stroking the path.
      */
     public void stroke() throws IOException


to understand about content streams, download the source code and look a the
examples. Here's one that creates filled boxes:

             PDDocument doc = new PDDocument();

             PDPage page = new PDPage();
             doc.addPage( page );

             PDPageContentStream contentStream = new
PDPageContentStream(doc, page);
             //first fill the entire background with cyan
             contentStream.setNonStrokingColor( Color.CYAN );
             contentStream.fillRect( 0,0, page.findMediaBox().getWidth(),
page.findMediaBox().getHeight() );

             //then draw a red box in the lower left hand corner
             contentStream.setNonStrokingColor( Color.RED );
             contentStream.fillRect( 10, 10, 100, 100 );

             contentStream.close();
             doc.save( file );



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


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


Mime
View raw message