Skip to content

Commit 85bf9e4

Browse files
michaeldemeyiText-CI
authored andcommitted
Update Javadocs of PdfCanvas#addXobject(PdfXObject, Rectangle) to mention scaling behavior. DEVSIX-2541
1 parent fd08e4d commit 85bf9e4

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

kernel/src/main/java/com/itextpdf/kernel/pdf/canvas/PdfCanvas.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2014,9 +2014,13 @@ public PdfCanvas addXObject(PdfXObject xObject, float x, float y) {
20142014

20152015
/**
20162016
* Adds {@code PdfXObject} to specified rectangle on canvas.
2017+
* Do note that using this method of adding an XObject <b>will scale</b> the XObject using the width and the height
2018+
* of the provided Rectangle. If you don't wish to scale the XObject, use {@link PdfCanvas#addXObject(PdfXObject, float, float)},
2019+
* {@link PdfCanvas#addXObject(PdfXObject, float, float, float)}, {@link PdfCanvas#addXObject(PdfXObject, float, float, float, boolean)},
2020+
* or {@link PdfCanvas#addXObject(PdfXObject, float, float, float, float, float, float)}.
20172021
*
2018-
* @param xObject
2019-
* @param rect
2022+
* @param xObject the XObject to add
2023+
* @param rect rectangle containing x and y coordinates and scaling information
20202024
* @return current canvas.
20212025
*/
20222026
public PdfCanvas addXObject(PdfXObject xObject, Rectangle rect) {
@@ -2288,10 +2292,10 @@ private PdfCanvas addForm(PdfFormXObject form, float x, float y) {
22882292
}
22892293

22902294
/**
2291-
* Adds {@code PdfFormXObject} to specified rectangle on canvas.
2295+
* Adds {@code PdfFormXObject} to specified rectangle on canvas and scale it using the rectangle's width and height.
22922296
*
2293-
* @param form
2294-
* @param rect
2297+
* @param form PdfFormXObject to add
2298+
* @param rect rectangle containing x and y coordinates and scaling information
22952299
* @return current canvas.
22962300
*/
22972301
private PdfCanvas addForm(PdfFormXObject form, Rectangle rect) {
@@ -2378,10 +2382,10 @@ private PdfCanvas addImage(PdfImageXObject image, float x, float y) {
23782382
}
23792383

23802384
/**
2381-
* Adds {@code PdfImageXObject} to specified rectangle on canvas.
2385+
* Adds {@code PdfImageXObject} to specified rectangle on canvas and scale it using the rectangle's width and height.
23822386
*
2383-
* @param image
2384-
* @param rect
2387+
* @param image PdfImageXObject to add
2388+
* @param rect rectangle containing x and y coordinates and scaling information
23852389
* @return current canvas
23862390
*/
23872391
private PdfCanvas addImage(PdfImageXObject image, Rectangle rect) {

0 commit comments

Comments
 (0)