You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by 遗忘记忆 <98...@qq.com> on 2016/01/12 10:07:53 UTC
any questions about or problems with Apache PDFBox
Hello:
Recently the pdfbox demo, when PrintTextLocations about writeString () method, this TextPosition how to create how to transfer can provide a demo? thank you
Re: any questions about or problems with Apache PDFBox
Posted by Tilman Hausherr <TH...@t-online.de>.
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