Hi Tilman, I think the javadoc method description is wrong forsetNonStrokingColor(float r, float g, float b). The method description says: "Set the non-stroking color in the DeviceRGB color space. Range is 0..255." The code validates that r, g, b are in the interval [0.0, 1.0]. Cheers, John On Monday, February 21, 2022, 09:14:56 AM PST, Tilman Hausherr <thaush...@t-online.de> wrote: Am 21.02.2022 um 10:23 schrieb Vassallo, Fabio: > > Good morning. > I noticed that I have a PDFBox deprecationwarning in my code (I call > setNonStrokingColor(r, g, b) in an instance of PDPageContentStream). > You should use the other call with float r, g, b. Divide your values by 255f.
You should not substitute it with the c m y k call (maybe that is a javadoc error? Make sure you're using the latest version 2.0.25). CMYK is a different color model than RGB. If you don't know what it means, then you won't need it 😂. It is used for printing. https://en.wikipedia.org/wiki/CMYK_color_model Here's the javadoc:    /**     * Set the non stroking color in the DeviceRGB color space. Range is 0..255.     *     * @param r The red value     * @param g The green value.     * @param b The blue value.     * @throws IOException If an IO error occurs while writing to the stream.     * @throws IllegalArgumentException If the parameters are invalid.     * @deprecated use     * {@link #setNonStrokingColor(float, float, float) setNonStrokingColor(r/255f, g/255f, b/255f)}     */ Tilman > > > @Deprecated > public void setNonStrokingColor(int r, int g, int b) throws IOException { > if (!this.isOutside255Interval(rainbow) && > !this.isOutside255Interval(gift) && !this.isOutside255Interval(beer)) { > this.setNonStrokingColor((float)r / 255.0F, (float)g / 255.0F, > (float)b / 255.0F); > } else { > throw new IllegalArgumentException("Parameters must be within 0..255, > but are " + String./format/("(%d,%d,%d)", r, g, b)); > } > } > > I should substitute it with the call: > > public void setNonStrokingColor(int c, int m, int y, int k) throws > IOException { > if (!this.isOutside255Interval(c) && !this.isOutside255Interval(m) && > !this.isOutside255Interval(y) && !this.isOutside255Interval(k)) { > this.setNonStrokingColor((float)c / 255.0F, (float)m / 255.0F, > (float)y / 255.0F, (float)k / 255.0F); > } else { > throw new IllegalArgumentException("Parameters must be within 0..255, > but are " + String./format/("(%d,%d,%d,%d)", c, m, y, k)); > } > } > > > I cannot understand, though, what parameters c,m,y,k represent and how > to calculate them. > Can you help me? > > Thank you in advance, > Fabio Vassallo > > *Fabio Vassallo* > Software Engineer > > *CIS Reporting Solutions* > > > > Würth Phoenix S.r.l. > Via Kravogl 4 > 39100 Bolzano- Italy > T: +39 0471 564 116 > > www.wuerth-phoenix.com <https://www.wuerth-phoenix.com/> > > <https://www.linkedin.com/company/wuerth-phoenix> > <https://twitter.com/WuerthPhoenix> > <https://www.instagram.com/wuerthphoenix/> > <https://www.facebook.com/Wuerth-Phoenix> > <https://www.youtube.com/user/WuerthPhoenix> > > GDPR EU 2016/679 / D.Lgs.196/03 - Privacy Regulation. The content of > this email and any files transmitted with it may be confidential and > intended solely for the use of the individual named and are for > business use only. If you have received this email in error please let > us know and delete the content from your system. You may not > distribute, copy or disclose the information to anyone. We do not > accept any liability if this email is used for an alternative purpose > from which it is intended, nor to any third party in respect thereof. > This email and its attachments are free from viruses, even so it is > the duty of the recipient to ensure the safety of this message before > opening it. Würth Phoenix S.r.l. does not accept liability for any > errors or omissions in the contents of this message, which arise as a > result of email transmission. >