public class Canvas extends Paragraph
Represents a Canvs Paragraph
in a Pdf document.
[Java] aspose.pdf.generator.Pdf pdf = new aspose.pdf.generator.Pdf(0; aspose.pdf.generator.Section sec = new aspose.pdf.generator.Section(); pdf.getSections().add(sec); aspose.pdf.generator.Canvas canvas = new aspose.pdf.generator.Canvas(); canvas.setFillColor ( new aspose.pdf.generator.Color(0, 128, 128)); sec.getParagraphs().add(canvas); aspose.pdf.generator.FloatingBox fb1 = new aspose.pdf.generator.FloatingBox(); fb1.setLeft ( 250f); fb1.setTop ( 150f); fb1.getParagraphs().add(new aspose.pdf.generator.Text("This is a text in floating box."))); canvas.getParagraphs().add(fb1); aspose.pdf.generator.FloatingBox fb2 = new aspose.pdf.generator.FloatingBox(); fb2.setLeft ( 50f); fb2.setTop ( 100f); aspose.pdf.generator.image image2 = new aspose.pdf.generator.Image(); image2.getImageInfo().setFile ( "temp.jpeg"); image2.getImageInfo().setImageFileType ( aspose.pdf.generator.ImageFileType.Jpeg); fb2.getParagraphs().add(image2); canvas.getParagraphs().add(fb2); pdf.save(...); [XML] <Pdf xmlns="Aspose.Pdf"> <Section> <Canvas Width="450" Height="440"> <Border> <Box LineWidth="0.5"> </Box> </Border> <FloatingBox Left="250" Top="150"> <Text> <Segment>This is a text in floating box. </Segment> </Text> </FloatingBox> <FloatingBox Left="50" Top="100"> <Image File="F:/temp/temp.002.jpeg" Type="Jpeg"> </Image> </FloatingBox> </Canvas> <Text> <Segment>ADFASFDASDF </Segment> </Text> </Section> </Pdf>
Modifier and Type | Field and Description |
---|---|
BorderInfo |
Border
Gets or sets a
BorderInfo object that indicates the border info of the canvas. |
Color |
FillColor
Gets or sets a
Aspose.Pdf.Generator.Color object that indicates the background color of the
canvas. |
Paragraphs |
Paragraphs
Gets or sets a
GraphInfo collection that indicates all paragraphs in the section. |
_PositioningType, FixedHeight, FixedWidth, ID, IsDisabled, IsFirstParagraph, IsFirstParagraphInColumn, IsInList, IsKeptTogether, IsKeptWithNext, IsOnOddPage, Left, Margin, ReferenceParagraphID, Top
Constructor and Description |
---|
Canvas()
Initializes a new instance of the
Canvas class with default width(available page width) and height(279F). |
Canvas(float width,
float height)
Initializes a new instance of the
Canvas class with specified width and height. |
Modifier and Type | Method and Description |
---|---|
Object |
completeClone() |
Object |
deepClone()
Clones a new
Canvas object. |
float |
getBoxHeight()
Gets or sets a float value that indicates the height of the canvas.
|
float |
getBoxWidth()
Gets or sets a float value that indicates the width of the canvas.
|
void |
setBoxHeight(float value) |
void |
setBoxWidth(float value) |
copyTo, getBookmarked, setBookmarked
load
public BorderInfo Border
Gets or sets a BorderInfo
object that indicates the border info of the canvas.
public Color FillColor
Gets or sets a Aspose.Pdf.Generator.Color
object that indicates the background color of the
canvas.
public Paragraphs Paragraphs
Gets or sets a GraphInfo
collection that indicates all paragraphs in the section.
public Canvas(float width, float height)
Initializes a new instance of the Canvas
class with specified width and height.
width
- The width of the Canvas.height
- The height of the Canvas.public Canvas()
Initializes a new instance of the Canvas
class with default width(available page width) and height(279F).
public float getBoxWidth()
Gets or sets a float value that indicates the width of the canvas.
public void setBoxWidth(float value)
public float getBoxHeight()
Gets or sets a float value that indicates the height of the canvas.
public void setBoxHeight(float value)
public Object completeClone()
completeClone
in class Paragraph
public Object deepClone()
Clones a new Canvas
object. Paragraphs in the canvas are not cloned.
Canvas
object.Copyright © 2014 Aspose. All Rights Reserved.