aspose.pdf
Class Canvas

java.lang.Object
  extended by aspose.pdf.Paragraph
      extended by aspose.pdf.Canvas

public class Canvas
extends Paragraph

Represents a Canvas in a Pdf document.

Typical usages are the following:

[Java] aspose.pdf.Pdf pdf = new aspose.pdf.Pdf(); aspose.pdf.Section sec = new aspose.pdf.Section(); pdf.getSections().add(sec); aspose.pdf.Canvas canvas = new aspose.pdf.Canvas(); canvas.setFillColor(new aspose.pdf.Color((short)0, (short)128, (short)128)); sec.getParagraphs().add(canvas); aspose.pdf.FloatingBox fb1 = new aspose.pdf.FloatingBox(); fb1.setLeft(250F); fb1.setTop(150F); fb1.getParagraphs().add(new aspose.pdf.Text("This is a text in floating box.")); canvas.getParagraphs().add(fb1); aspose.pdf.FloatingBox fb2 = new aspose.pdf.FloatingBox(); fb2.setLeft(50F); fb2.setTop(100F); aspose.pdf.Image image2 = new aspose.pdf.Image(); image2.getImageInfo().setFile("temp.jpeg"); image2.getImageInfo().setImageFileType(aspose.pdf.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>


Nested Class Summary
 
Nested classes/interfaces inherited from class aspose.pdf.Paragraph
Paragraph.VerticalPositionInfo
 
Field Summary
 
Fields inherited from class aspose.pdf.Paragraph
INNER_INDENT, isNeedAddToPage, isPositionProcessed, RealPageNumber, VerticalPosInfo
 
Constructor Summary
Canvas()
          Constructor - initializes a new instance of the Canvas class with default width(available page width) and height(279F).
Canvas(float width, float height)
          Constructor - initializes a new instance of the Canvas class with specified width and height.
 
Method Summary
 java.lang.Object clone()
          Clones a new Canvas object.
 java.lang.Object completeClone()
           
 BorderInfo getBorder()
          Gets a a BorderInfo object that indicates the border info of the canvas.
 float getBoxHeight()
          Gets a float value that indicates the height of the canvas.
 float getBoxWidth()
          Gets a float value that indicates the width of the canvas.
 Color getFillColor()
          Gets a Color object that indicates the background color of the canvas.
 boolean getIsWidthSet()
          Gets a boolean value that indicates whether the WidthSet property of the canvas has been set.
 Paragraphs getParagraphs()
          Gets a GraphInfo collection that indicates all paragraphs in the section.
 void setBorder(BorderInfo boxBorder)
          Sets a a BorderInfo object that indicates the border info of the canvas.
 void setBoxHeight(float value)
          Sets a float value that indicates the height of the canvas.
 void setBoxWidth(float value)
          Sets a float value that indicates the width of the canvas.
 void setFillColor(Color backColor)
          Sets a Color object that indicates the background color of the canvas.
 void setParagraphs(Paragraphs docParas)
          Sets a GraphInfo collection that indicates all paragraphs in the section.
 
Methods inherited from class aspose.pdf.Paragraph
copyTo, getHeight, getID, getIsNeedAddToPage, getIsPositionGot, getIsPositionProcessed, getLeft, getMargin, getMayNeedReprocess, getNeedReprocess, getNextParagraphInHeading, getPageNumber, getParentCell, getPositioningType, getPosX, getPosY, getRealPageNumber, getReferenceParagraphID, getRefPara, getSection, getTop, getVerticalPosInfo, getWidth, isDisabled, isEndNote, isFirstParagraph, isFirstParagraphInColumn, isFootNote, isFootNoteProcessed, isInHeaderFooter, isInList, isKeptTogether, isKeptWithNext, isOnOddPage, setEndNote, setFootNoteProcessed, setHeight, setID, setIsDisabled, setIsFirstParagraph, setIsFirstParagraphInColumn, setIsFootNote, setIsInHeaderFooter, setIsInList, setIsKeptTogether, setIsKeptWithNext, setIsNeedAddToPage, setIsOnOddPage, setIsPositionGot, setIsPositionProcessed, setLeft, setMargin, setMayNeedReprocess, setNeedReprocess, setNextParagraphInHeading, setPageNumber, setParentCell, setParentIsTable, setPositioningType, setPosX, setPosY, setRealPageNumber, setReferenceParagraphID, setRefPara, setSection, setTop, setVerticalPosInfo, setWidth
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Canvas

public Canvas(float width,
              float height)
Constructor - initializes a new instance of the Canvas class with specified width and height.

Parameters:
width - The width of the Canvas.
height - The height of the Canvas.

Canvas

public Canvas()
Constructor - initializes a new instance of the Canvas class with default width(available page width) and height(279F).

Method Detail

getIsWidthSet

public boolean getIsWidthSet()
Gets a boolean value that indicates whether the WidthSet property of the canvas has been set.

Returns:
A boolean value.

setBoxWidth

public void setBoxWidth(float value)
Sets a float value that indicates the width of the canvas.

Parameters:
value - BoxWidth value.

getBoxWidth

public float getBoxWidth()
Gets a float value that indicates the width of the canvas.

Returns:
A float value.

getBoxHeight

public float getBoxHeight()
Gets a float value that indicates the height of the canvas.


setBoxHeight

public void setBoxHeight(float value)
Sets a float value that indicates the height of the canvas.

Parameters:
value - BoxHeigh value.

getBorder

public BorderInfo getBorder()
Gets a a BorderInfo object that indicates the border info of the canvas.

Returns:
A BorderInfo object.

setBorder

public void setBorder(BorderInfo boxBorder)
Sets a a BorderInfo object that indicates the border info of the canvas.

Parameters:
boxBorder - BorderInfo object.

getFillColor

public Color getFillColor()
Gets a Color object that indicates the background color of the canvas.

Returns:
A Color object.

setFillColor

public void setFillColor(Color backColor)
Sets a Color object that indicates the background color of the canvas.

Parameters:
backColor - Color object.

getParagraphs

public Paragraphs getParagraphs()
Gets a GraphInfo collection that indicates all paragraphs in the section.

Returns:
A GraphInfo object.

setParagraphs

public void setParagraphs(Paragraphs docParas)
Sets a GraphInfo collection that indicates all paragraphs in the section.

Parameters:
docParas - Paragraphs object.

completeClone

public java.lang.Object completeClone()
Specified by:
completeClone in class Paragraph

clone

public java.lang.Object clone()

Clones a new Canvas object. Paragraphs in the canvas are not cloned.

Overrides:
clone in class java.lang.Object
Returns:
The new Canvas object.