pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tilman Hausherr <THaush...@t-online.de>
Subject Re: any questions about or problems with Apache PDFBox
Date Tue, 12 Jan 2016 17:08:51 GMT
Am 12.01.2016 um 10:07 schrieb 遗忘记忆:
> Hello:
>
>
>
> Recently the pdfbox demo, when PrintTextLocations about writeString () method, this TextPosition
how to create how to transfer can provide a demo? thank you

Hello 遗忘记忆,

Your text is almost impossible to understand, but I suspect you are 
asking about a recent post of mine where I explained that writeString 
can be overridden. There is no demo for 1.8, but you can modify the 
PrintTextLocations example by adding this:

     protected void writeString(String string, List<TextPosition> 
textPositions) throws IOException
     {
         for (TextPosition text : textPositions)
         {
              System.out.println( "String[" + text.getXDirAdj() + "," +
                 text.getYDirAdj() + " fs=" + text.getFontSize() + " 
xscale=" +
                 text.getXScale() + " height=" + text.getHeightDir() + " 
space=" +
                 text.getWidthOfSpace() + " width=" +
                 text.getWidthDirAdj() + "]" + text.getCharacter() );
         }
     }

and remove processTextPosition().

In 2.0 you can use PrintTextLocations or DrawPrintTextLocations directly.


Or is your question how to get the examples to run? The easiest way is 
from your IDE, configure it to use that class as main, and don't forget 
to configure the parameters. Another way is to change the source to 
assign the parameters to the "args" variable and then do "run file":

     args = new String[]{"path"};

Or create a new project, and copy the sample class into it.

Tilman

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


Mime
View raw message