com.ironsoftware.ironpdf.stamp.TextStamper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ironpdf Show documentation
Show all versions of ironpdf Show documentation
IronPDF Java library offers an extensive compatibility range, making it a go-to solution for a wide array of developers. It fully supports JVM languages like Java, Scala, and Kotlin, making it incredibly versatile. This Java PDF library is also compatible with Java 8 and above, providing optimum performance across multiple platforms. It's been designed with a wide range of users in mind Here's a look at what it supports: JVM Languages: Java, Scala, Kotlin.Platforms: Java 8 and above.Operating Systems: Microsoft Windows, Linux, Docker, Azure, AWS.IDEs: Jetbrains IntelliJ IDEA, Eclipse. You can deploy IronPDF Java across various platforms, including Microsoft Windows, Linux, Docker, Azure, and AWS. It is also fully compatible with popular IDEs like Jetbrains IntelliJ IDEA and Eclipse, facilitating smooth project development and management. Your pom.xml file is essentially the backbone of your project when you're using Maven. It's here where you introduce new dependencies that you wish to include. To make IronPDF Java package a part of your Maven project, you simply need to add the following snippets to your pom.xml: Remember to replace '20xx.xx.xxxx' with the latest version of IronPDF. IronPDF Java simplifies the process of creating PDF files. Convert HTML files, HTML strings, or URLs directly to new PDF documents in a few lines of code. The variety of file formats it handles is vast, as it can even transform images into PDF documents and vice versa. Need to use base 64 encoding, base URLs, or custom file paths? No problem! IronPDF Java has got you coveredFor more detail about installing and using IronPDF Java. When you run your project for the first time post-integration, IronPDF's engine binaries will automatically be downloaded. The engine starts its journey when you call any IronPDF function for the first time and takes a breather when your application is either closed or enters an idle state. It is not an open source java PDF library but here's the best part - IronPDF Java is offering a 30-day free trial. So, why wait? Give it a go and boost your PDF operations today.
package com.ironsoftware.ironpdf.stamp;
import com.ironsoftware.ironpdf.edit.PageSelection;
import java.awt.*;
/**
* This allows the user to edit an existing PDF by adding some stamped text. A subclass of
* {@link Stamper}. Defines a Text PDF Stamper. Can be applied with:
* {@link com.ironsoftware.ironpdf.PdfDocument#applyStamp(Stamper, PageSelection)}
*/
public class TextStamper extends Stamper {
/**
* The text to be stamped by the Stamper
*/
private String text;
/**
* Determines if the bold font weight is applied.
*/
private boolean isBold = false;
/**
* Determines if the text has the italic font style applied.
*/
private boolean isItalic = false;
/**
* Determines if the text has an underline font style applied.
*/
private boolean isUnderline = false;
/**
* Determines if the text has a strike-through applied.
*/
private boolean isStrikethrough = false;
/**
* Font size in px.
*/
private int fontSize = 12;
/**
* Font family name for the text.
* Note: If using a web font from font.google then you must set {@link #setUseGoogleFont} property of this TextStamper to true.
*/
private String fontFamily = "Arial";
/**
Font Color. Default is '#000000' (Black).
*/
private String fontColorCode = "#000000";
/**
Background Color. Default is '#00FFFFFF' (Transparent).
*/
private String backgroundColorCode = "#00FFFFFF" ;
/**
* Must be set to true to when using {@link #fontFamily} from font.google as a web
* font
*/
private boolean useGoogleFont = false;
/**
* Instantiates a new Text stamper. This allows the user to edit an existing PDF by adding some stamped text. A subclass of
* {@link Stamper}. Defines a Text PDF Stamper. Can be applied with:
* {@link com.ironsoftware.ironpdf.PdfDocument#applyStamp(Stamper, PageSelection)}
*/
public TextStamper() {
setText("");
}
/**
* Instantiates a new Text stamper. This allows the user to edit an existing PDF by adding some stamped text. A subclass of
* {@link Stamper}. Defines a Text PDF Stamper. Can be applied with:
* {@link com.ironsoftware.ironpdf.PdfDocument#applyStamp(Stamper, PageSelection)}
*
* @param text the text to be stamped by the Stamper
*/
public TextStamper(String text) {
setText(text);
}
/**
* Gets text to be stamped by the Stamper
*
* @return the text
*/
public final String getText() {
return text;
}
/**
* Sets text to be stamped by the Stamper
*
* @param value the value
*/
public final void setText(String value) {
text = value;
}
/**
* Is bold boolean. Determines if the bold font weight is applied.
*
* @return the boolean
*/
public final boolean isBold() {
return isBold;
}
/**
* Sets bold. Determines if the bold font weight is applied.
*
* @param value the value
*/
public final void setBold(boolean value) {
isBold = value;
}
/**
* Is italic boolean. Determines if the text has the italic font style applied.
*
* @return the boolean
*/
public final boolean isItalic() {
return isItalic;
}
/**
* Sets italic. Determines if the text has the italic font style applied.
*
* @param value the value
*/
public final void setItalic(boolean value) {
isItalic = value;
}
/**
* Is underline boolean. Determines if the text has an underline font style applied.
*
* @return the boolean
*/
public final boolean isUnderline() {
return isUnderline;
}
/**
* Sets underline. Determines if the text has an underline font style applied.
*
* @param value the value
*/
public final void setUnderline(boolean value) {
isUnderline = value;
}
/**
* Is strikethrough boolean. Determines if the text has a strike-through applied.
*
* @return the boolean
*/
public final boolean isStrikethrough() {
return isStrikethrough;
}
/**
* Sets strikethrough. Determines if the text has a strike-through applied.
*
* @param value the value
*/
public final void setStrikethrough(boolean value) {
isStrikethrough = value;
}
/**
* Gets font size. Font size in px.
*
* @return the font size
*/
public final int getFontSize() {
return fontSize;
}
/**
* Sets font size. Font size in px.
*
* @param value the value
*/
public final void setFontSize(int value) {
fontSize = value;
}
/**
* Gets font family. Font family name for the text.
*
* Note: If using a web font from font.google then you must set {@link #setUseGoogleFont} property of this TextStamper to true.
*
* @return the font family
*/
public final String getFontFamily() {
return fontFamily;
}
/**
* Sets font family. Font family name for the text.
* Note: If using a web font from font.google then you must set {@link #setUseGoogleFont} property of this TextStamper to true.
*
* @param value the value
*/
public final void setFontFamily(String value) {
fontFamily = value;
}
/**
* Is use google font boolean. Working with {@link #setFontFamily(String)}
*
* @return the boolean
*/
public final boolean isUseGoogleFont() {
return useGoogleFont;
}
/**
* Sets use google font. {@link #setFontFamily(String)}
*
* @param value the value
*/
public final void setUseGoogleFont(boolean value) {
useGoogleFont = value;
}
/**
* Gets Font Color. Default is '#000000' (Black).
*
* @return the font color
*/
public final String getFontColorCode() {
return fontColorCode;
}
/**
* Sets Font Color. Default is '#000000' (Black).
*
* @param value font color
*/
public final void setFontColor(String value) {
fontColorCode = value;
}
/**
* Gets Background Color. Default is '#00FFFFFF' (Transparent).
*
* @return the font color
*/
public final String getBackgroundColorCode() {
return backgroundColorCode;
}
/**
* Sets Background Color. Default is '#00FFFFFF' (Transparent).
*
* @param value font color
*/
public final void setBackgroundColorCode(String value) {
backgroundColorCode = value;
}
}