You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@pdfbox.apache.org by Jan Tosovsky <j....@email.cz> on 2016/03/13 21:45:50 UTC
Replacement for appendRawCommands
Dear All,
I am trying to fill and stroke my Bezier path object in one step, but I
cannot find any standard way in pdfBox 2.0 API. So far I only found
utilizing a deprecated method appendRawCommands("\nB*\n")
http://stackoverflow.com/questions/32064316/pdfbox-unable-to-draw-bezier-cur
ve
What is proper replacement, if any?
Thanks, Jan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
RE: Replacement for appendRawCommands
Posted by Jan Tosovsky <j....@email.cz>.
Cool! Glad to see this is covered. I'll update my code accordingly when 2.0
final is out.
Thanks, Jan
> -----Original Message-----
> From: Tilman Hausherr [mailto:THausherr@t-online.de]
> Sent: Sunday, March 13, 2016 10:18 PM
> To: users@pdfbox.apache.org
> Subject: Re: Replacement for appendRawCommands
>
> This is available as
>
> fillAndStrokeEvenOdd
>
> but not in RC3, only in the SNAPSHOT and the upcoming release.
>
> Tilman
>
>
>
> /**
> * Fills the path using the nonzero winding number rule.
> *
> * @throws IOException If the content stream could not be written
> * @throws IllegalStateException If the method was called within a
> text block.
> */
> public void fill() throws IOException
> {
> if (inTextMode)
> {
> throw new IllegalStateException("Error: fill is not
> allowed
> within a text block.");
> }
> writeOperator("f");
> }
>
> /**
> * Fills the path using the even-odd winding rule.
> *
> * @throws IOException If the content stream could not be written
> * @throws IllegalStateException If the method was called within a
> text block.
> */
> public void fillEvenOdd() throws IOException
> {
> if (inTextMode)
> {
> throw new IllegalStateException("Error: fillEvenOdd is not
> allowed within a text block.");
> }
> writeOperator("f*");
> }
>
> /**
> * Fill and then stroke the path, using the nonzero winding number
> rule to determine the region
> * to fill. This shall produce the same result as constructing two
> identical path objects,
> * painting the first with {@link #fill() } and the second with
> {@link #stroke() }.
> *
> * @throws IOException If the content stream could not be written
> * @throws IllegalStateException If the method was called within a
> text block.
> */
> public void fillAndStroke() throws IOException
> {
> if (inTextMode)
> {
> throw new IllegalStateException("Error: fillAndStroke is
> not allowed within a text block.");
> }
> writeOperator("B");
> }
>
> /**
> * Fill and then stroke the path, using the even-odd rule to
> determine the region to
> * fill. This shall produce the same result as constructing two
> identical path objects, painting
> * the first with {@link #fillEvenOdd() } and the second with
> {@link #stroke() }.
> *
> * @throws IOException If the content stream could not be written
> * @throws IllegalStateException If the method was called within a
> text block.
> */
> public void fillAndStrokeEvenOdd() throws IOException
> {
> if (inTextMode)
> {
> throw new IllegalStateException("Error:
> fillAndStrokeEvenOdd is not allowed within a text block.");
> }
> writeOperator("B*");
> }
>
> /**
> * Close, fill, and then stroke the path, using the nonzero
> winding
> number rule to determine the
> * region to fill. This shall have the same effect as the sequence
> {@link #closePath() }
> * and then {@link #fillAndStroke() }.
> *
> * @throws IOException If the content stream could not be written
> * @throws IllegalStateException If the method was called within a
> text block.
> */
> public void closeAndFillAndStroke() throws IOException
> {
> if (inTextMode)
> {
> throw new IllegalStateException("Error:
> closeAndFillAndStroke is not allowed within a text block.");
> }
> writeOperator("b");
> }
>
> /**
> * Close, fill, and then stroke the path, using the even-odd rule
> to determine the region to
> * fill. This shall have the same effect as the sequence {@link
> #closePath() }
> * and then {@link #fillAndStrokeEvenOdd() }.
> *
> * @throws IOException If the content stream could not be written
> * @throws IllegalStateException If the method was called within a
> text block.
> */
> public void closeAndFillAndStrokeEvenOdd() throws IOException
> {
> if (inTextMode)
> {
> throw new IllegalStateException("Error:
> closeAndFillAndStrokeEvenOdd is not allowed within a text block.");
> }
> writeOperator("b*");
> }
>
>
> Am 13.03.2016 um 21:45 schrieb Jan Tosovsky:
> > Dear All,
> >
> > I am trying to fill and stroke my Bezier path object in one step, but
> I
> > cannot find any standard way in pdfBox 2.0 API. So far I only found
> > utilizing a deprecated method appendRawCommands("\nB*\n")
> >
> > http://stackoverflow.com/questions/32064316/pdfbox-unable-to-draw-
> bezier-cur
> > ve
> >
> > What is proper replacement, if any?
> >
> > Thanks, Jan
> >
> >
> > ---------------------------------------------------------------------
> > 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
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org
Re: Replacement for appendRawCommands
Posted by Tilman Hausherr <TH...@t-online.de>.
This is available as
fillAndStrokeEvenOdd
but not in RC3, only in the SNAPSHOT and the upcoming release.
Tilman
/**
* Fills the path using the nonzero winding number rule.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a
text block.
*/
public void fill() throws IOException
{
if (inTextMode)
{
throw new IllegalStateException("Error: fill is not allowed
within a text block.");
}
writeOperator("f");
}
/**
* Fills the path using the even-odd winding rule.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a
text block.
*/
public void fillEvenOdd() throws IOException
{
if (inTextMode)
{
throw new IllegalStateException("Error: fillEvenOdd is not
allowed within a text block.");
}
writeOperator("f*");
}
/**
* Fill and then stroke the path, using the nonzero winding number
rule to determine the region
* to fill. This shall produce the same result as constructing two
identical path objects,
* painting the first with {@link #fill() } and the second with
{@link #stroke() }.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a
text block.
*/
public void fillAndStroke() throws IOException
{
if (inTextMode)
{
throw new IllegalStateException("Error: fillAndStroke is
not allowed within a text block.");
}
writeOperator("B");
}
/**
* Fill and then stroke the path, using the even-odd rule to
determine the region to
* fill. This shall produce the same result as constructing two
identical path objects, painting
* the first with {@link #fillEvenOdd() } and the second with
{@link #stroke() }.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a
text block.
*/
public void fillAndStrokeEvenOdd() throws IOException
{
if (inTextMode)
{
throw new IllegalStateException("Error:
fillAndStrokeEvenOdd is not allowed within a text block.");
}
writeOperator("B*");
}
/**
* Close, fill, and then stroke the path, using the nonzero winding
number rule to determine the
* region to fill. This shall have the same effect as the sequence
{@link #closePath() }
* and then {@link #fillAndStroke() }.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a
text block.
*/
public void closeAndFillAndStroke() throws IOException
{
if (inTextMode)
{
throw new IllegalStateException("Error:
closeAndFillAndStroke is not allowed within a text block.");
}
writeOperator("b");
}
/**
* Close, fill, and then stroke the path, using the even-odd rule
to determine the region to
* fill. This shall have the same effect as the sequence {@link
#closePath() }
* and then {@link #fillAndStrokeEvenOdd() }.
*
* @throws IOException If the content stream could not be written
* @throws IllegalStateException If the method was called within a
text block.
*/
public void closeAndFillAndStrokeEvenOdd() throws IOException
{
if (inTextMode)
{
throw new IllegalStateException("Error:
closeAndFillAndStrokeEvenOdd is not allowed within a text block.");
}
writeOperator("b*");
}
Am 13.03.2016 um 21:45 schrieb Jan Tosovsky:
> Dear All,
>
> I am trying to fill and stroke my Bezier path object in one step, but I
> cannot find any standard way in pdfBox 2.0 API. So far I only found
> utilizing a deprecated method appendRawCommands("\nB*\n")
>
> http://stackoverflow.com/questions/32064316/pdfbox-unable-to-draw-bezier-cur
> ve
>
> What is proper replacement, if any?
>
> Thanks, Jan
>
>
> ---------------------------------------------------------------------
> 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