Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
This file is part of the iText (R) project.
Copyright (c) 1998-2024 Apryse Group NV
Authors: Apryse Software.
This program is offered under a commercial and under the AGPL license.
For commercial licensing, contact us at https://itextpdf.com/sales. For AGPL licensing, see below.
AGPL licensing:
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see .
*/
package com.itextpdf.layout;
import com.itextpdf.kernel.font.PdfFont;
import com.itextpdf.kernel.font.PdfFontFactory;
import com.itextpdf.kernel.pdf.IsoKey;
import com.itextpdf.kernel.pdf.PdfDocument;
import com.itextpdf.kernel.pdf.canvas.PdfCanvasConstants;
import com.itextpdf.kernel.pdf.tagging.StandardRoles;
import com.itextpdf.layout.element.BlockElement;
import com.itextpdf.layout.element.Div;
import com.itextpdf.layout.element.IBlockElement;
import com.itextpdf.layout.element.IElement;
import com.itextpdf.layout.element.Image;
import com.itextpdf.layout.element.Paragraph;
import com.itextpdf.layout.font.FontProvider;
import com.itextpdf.layout.properties.FontKerning;
import com.itextpdf.layout.properties.HorizontalAlignment;
import com.itextpdf.layout.properties.Leading;
import com.itextpdf.layout.properties.Property;
import com.itextpdf.layout.properties.TextAlignment;
import com.itextpdf.layout.properties.UnitValue;
import com.itextpdf.layout.properties.VerticalAlignment;
import com.itextpdf.layout.renderer.IRenderer;
import com.itextpdf.layout.renderer.RootRenderer;
import com.itextpdf.layout.splitting.DefaultSplitCharacters;
import com.itextpdf.layout.splitting.ISplitCharacters;
import com.itextpdf.layout.tagging.LayoutTaggingHelper;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* A generic abstract root element for a PDF layout object hierarchy.
*
* @param this type
*/
public abstract class RootElement extends ElementPropertyContainer implements Closeable {
protected boolean immediateFlush = true;
protected PdfDocument pdfDocument;
protected List childElements = new ArrayList<>();
protected PdfFont defaultFont;
protected FontProvider defaultFontProvider;
protected ISplitCharacters defaultSplitCharacters;
protected RootRenderer rootRenderer;
private LayoutTaggingHelper defaultLayoutTaggingHelper;
/**
* Adds an element to the root. The element is immediately placed in the contents.
*
* @param element an element with spacial margins, tabbing, and alignment
* @return this element
* @see BlockElement
*/
public T add(IBlockElement element) {
return addElement(element);
}
/**
* Adds an image to the root. The element is immediately placed in the contents.
*
* @param image a graphical image element
* @return this element
* @see Image
*/
public T add(Image image) {
return addElement(image);
}
/**
* Gets {@link FontProvider} if presents.
*
* @return instance of {@link FontProvider} if exists, otherwise null.
*/
public FontProvider getFontProvider() {
Object fontProvider = this.