class CreateLandscapePDF
{
    /**
     * Constructor.
     */
    public CreateLandscapePDF()
    {
        super();
    }

    /**
     * creates a sample document with a landscape orientation and some text surrounded by a box.
     *
     * @param message The message to write in the file.
     * @param outfile The resulting PDF.
     *
     * @throws IOException If there is an error writing the data.
     */
    public void doIt( String message, String  outfile ) throws IOException
    {<FILL_FUNCTION_BODY>}

    /**
     * This will create a PDF document with a landscape orientation and some text surrounded by a box.
     * 
     * @param args Command line arguments.
     */
    public static void main(String[] args) throws IOException
    {
        CreateLandscapePDF app = new CreateLandscapePDF();
        if( args.length != 2 )
        {
            app.usage();
        }
        else
        {
            app.doIt( args[0], args[1] );
        }
    }

    /**
     * This will print out a message telling how to use this example.
     */
    private void usage()
    {
        System.err.println( "usage: " + this.getClass().getName() + " <Message> <output-file>" );
    }
}

        try (PDDocument doc = new PDDocument())
        {
            PDFont font = new PDType1Font(FontName.HELVETICA);
            PDPage page = new PDPage(PDRectangle.A4);
            page.setRotation(90);
            doc.addPage(page);
            PDRectangle pageSize = page.getMediaBox();
            float pageWidth = pageSize.getWidth();
            float fontSize = 12;
            float stringWidth = font.getStringWidth( message )*fontSize/1000f;
            float startX = 100;
            float startY = 100;

            try (PDPageContentStream contentStream = new PDPageContentStream(doc, page, AppendMode.OVERWRITE, false))
            {
                // add the rotation using the current transformation matrix
                // including a translation of pageWidth to use the lower left corner as 0,0 reference
                contentStream.transform(new Matrix(0, 1, -1, 0, pageWidth, 0));
                contentStream.setFont( font, fontSize );
                contentStream.beginText();
                contentStream.newLineAtOffset(startX, startY);
                contentStream.showText(message);
                contentStream.newLineAtOffset(0, 100);
                contentStream.showText(message);
                contentStream.newLineAtOffset(100, 100);
                contentStream.showText(message);
                contentStream.endText();
                
                contentStream.moveTo(startX-2, startY-2);
                contentStream.lineTo(startX-2, startY+200+fontSize);
                contentStream.stroke();
                
                contentStream.moveTo(startX-2, startY+200+fontSize);
                contentStream.lineTo(startX+100+stringWidth+2, startY+200+fontSize);
                contentStream.stroke();
                
                contentStream.moveTo(startX+100+stringWidth+2, startY+200+fontSize);
                contentStream.lineTo(startX+100+stringWidth+2, startY-2);
                contentStream.stroke();
                
                contentStream.moveTo(startX+100+stringWidth+2, startY-2);
                contentStream.lineTo(startX-2, startY-2);
                contentStream.stroke();
            }

            doc.save( outfile );
        }
    
<no_super_class>