idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
5,200 | public void writeContent ( final OutputStream result ) throws IOException { result . write ( PARAGRAPH_DEFAULTS ) ; result . write ( PLAIN ) ; if ( inTable ) { result . write ( IN_TABLE ) ; } if ( this . paragraphStyle != null ) { this . paragraphStyle . writeBegin ( result ) ; } result . write ( DocWriter . getISOByte... | Writes the content of this RtfParagraph . First paragraph specific data is written and then the RtfChunks of this RtfParagraph are added . |
5,201 | private void writeFieldBegin ( OutputStream result ) throws IOException { result . write ( OPEN_GROUP ) ; result . write ( FIELD ) ; if ( fieldDirty ) result . write ( FIELD_DIRTY ) ; if ( fieldEdit ) result . write ( FIELD_EDIT ) ; if ( fieldLocked ) result . write ( FIELD_LOCKED ) ; if ( fieldPrivate ) result . write... | Writes the field beginning . Also writes field properties . |
5,202 | private void writeFieldInstBegin ( OutputStream result ) throws IOException { result . write ( OPEN_GROUP ) ; result . write ( FIELD_INSTRUCTIONS ) ; result . write ( DELIMITER ) ; } | Writes the beginning of the field instruction area . |
5,203 | private void writeFieldInstEnd ( OutputStream result ) throws IOException { if ( fieldAlt ) { result . write ( DELIMITER ) ; result . write ( FIELD_ALT ) ; } result . write ( CLOSE_GROUP ) ; } | Writes the end of the field instruction area . |
5,204 | private void writeFieldResultBegin ( final OutputStream result ) throws IOException { result . write ( OPEN_GROUP ) ; result . write ( FIELD_RESULT ) ; result . write ( DELIMITER ) ; } | Writes the beginning of the field result area |
5,205 | private void writeFieldResultEnd ( final OutputStream result ) throws IOException { result . write ( DELIMITER ) ; result . write ( CLOSE_GROUP ) ; } | Writes the end of the field result area |
5,206 | public void writeContent ( final OutputStream result ) throws IOException { result . write ( DocWriter . getISOBytes ( "\\shpleft" ) ) ; result . write ( intToByteArray ( this . left ) ) ; result . write ( DocWriter . getISOBytes ( "\\shptop" ) ) ; result . write ( intToByteArray ( this . top ) ) ; result . write ( Doc... | Write this RtfShapePosition . |
5,207 | public void writeListBeginning ( final OutputStream result ) throws IOException { result . write ( RtfParagraph . PARAGRAPH_DEFAULTS ) ; if ( this . inTable ) { result . write ( RtfParagraph . IN_TABLE ) ; } switch ( this . alignment ) { case Element . ALIGN_LEFT : result . write ( RtfParagraphStyle . ALIGN_LEFT ) ; br... | Writes the initialization part of the RtfList |
5,208 | public void writeContent ( final OutputStream result ) throws IOException { for ( int i = 0 ; i < this . tabs . size ( ) ; i ++ ) { RtfTab rt = ( RtfTab ) this . tabs . get ( i ) ; rt . writeContent ( result ) ; } } | Combines the tab output form all grouped tabs . |
5,209 | PdfRectangle rotateMediaBox ( ) { this . mediaBox = mediaBox . rotate ( ) ; put ( PdfName . MEDIABOX , this . mediaBox ) ; return this . mediaBox ; } | Rotates the mediabox but not the text in it . |
5,210 | public void fax4Encode ( byte [ ] data , int offset , int size ) { dataBp = data ; offsetData = offset ; sizeData = size ; while ( sizeData > 0 ) { Fax3Encode2DRow ( ) ; System . arraycopy ( dataBp , offsetData , refline , 0 , rowbytes ) ; offsetData += rowbytes ; sizeData -= rowbytes ; } } | Encodes a number of lines . |
5,211 | public static byte [ ] compress ( byte [ ] data , int width , int height ) { CCITTG4Encoder g4 = new CCITTG4Encoder ( width ) ; g4 . fax4Encode ( data , 0 , g4 . rowbytes * height ) ; return g4 . close ( ) ; } | Encodes a full image . |
5,212 | public void displayText ( String text , Matrix endingTextMatrix ) { boolean hardReturn = false ; if ( lastTextLineMatrix != null && lastTextLineMatrix . get ( Matrix . I32 ) != getCurrentTextLineMatrix ( ) . get ( Matrix . I32 ) ) { hardReturn = true ; } float currentX = getCurrentTextMatrix ( ) . get ( Matrix . I31 ) ... | Writes text to the result . |
5,213 | public Cell createCell ( SimpleCell rowAttributes ) throws BadElementException { Cell cell = new Cell ( ) ; cell . cloneNonPositionParameters ( rowAttributes ) ; cell . softCloneNonPositionParameters ( this ) ; cell . setColspan ( colspan ) ; cell . setHorizontalAlignment ( horizontalAlignment ) ; cell . setVerticalAli... | Creates a Cell with these attributes . |
5,214 | public PdfPCell createPdfPCell ( SimpleCell rowAttributes ) { PdfPCell cell = new PdfPCell ( ) ; cell . setBorder ( NO_BORDER ) ; SimpleCell tmp = new SimpleCell ( CELL ) ; tmp . setSpacing_left ( spacing_left ) ; tmp . setSpacing_right ( spacing_right ) ; tmp . setSpacing_top ( spacing_top ) ; tmp . setSpacing_bottom ... | Creates a PdfPCell with these attributes . |
5,215 | public void setPadding ( float padding ) { if ( Float . isNaN ( padding_right ) ) { setPadding_right ( padding ) ; } if ( Float . isNaN ( padding_left ) ) { setPadding_left ( padding ) ; } if ( Float . isNaN ( padding_top ) ) { setPadding_top ( padding ) ; } if ( Float . isNaN ( padding_bottom ) ) { setPadding_bottom (... | Sets the padding parameters if they are undefined . |
5,216 | public void writeContent ( final OutputStream result ) throws IOException { if ( this . paragraphStyle . getSpacingBefore ( ) > 0 ) { result . write ( RtfParagraphStyle . SPACING_BEFORE ) ; result . write ( intToByteArray ( paragraphStyle . getSpacingBefore ( ) ) ) ; } if ( this . paragraphStyle . getSpacingAfter ( ) >... | Writes the content of this RtfListItem . |
5,217 | public void inheritListSettings ( int listNumber , int listLevel ) { for ( int i = 0 ; i < chunks . size ( ) ; i ++ ) { RtfBasicElement rtfElement = ( RtfBasicElement ) chunks . get ( i ) ; if ( rtfElement instanceof RtfList ) { ( ( RtfList ) rtfElement ) . setListNumber ( listNumber ) ; setLevel ( listLevel ) ; } } } | Inherit the list settings from the parent list to RtfLists that are contained in this RtfListItem . |
5,218 | public int getColorNumber ( RtfColor color ) { int colorIndex = - 1 ; for ( int i = 0 ; i < colorList . size ( ) ; i ++ ) { if ( colorList . get ( i ) . equals ( color ) ) { colorIndex = i ; } } if ( colorIndex == - 1 ) { colorIndex = colorList . size ( ) ; colorList . add ( color ) ; } return colorIndex ; } | Returns the index of the given RtfColor in the color list . If the RtfColor is not in the list of colors then it is added . |
5,219 | public void writeDefinition ( final OutputStream result ) throws IOException { result . write ( OPEN_GROUP ) ; result . write ( COLOR_TABLE ) ; for ( int i = 0 ; i < colorList . size ( ) ; i ++ ) { RtfColor color = ( RtfColor ) colorList . get ( i ) ; color . writeDefinition ( result ) ; } result . write ( CLOSE_GROUP ... | Write the definition part of the color list . Calls the writeDefinition methods of the RtfColors in the color list . |
5,220 | protected void writeHeader ( Meta meta ) throws IOException { addTabs ( 2 ) ; writeStart ( HtmlTags . META ) ; switch ( meta . type ( ) ) { case Element . HEADER : write ( HtmlTags . NAME , ( ( Header ) meta ) . getName ( ) ) ; break ; case Element . SUBJECT : write ( HtmlTags . NAME , HtmlTags . SUBJECT ) ; break ; ca... | Writes a Metatag in the header . |
5,221 | protected void writeLink ( Header header ) throws IOException { addTabs ( 2 ) ; writeStart ( HtmlTags . LINK ) ; write ( HtmlTags . REL , header . getName ( ) ) ; write ( HtmlTags . TYPE , HtmlTags . TEXT_CSS ) ; write ( HtmlTags . REFERENCE , header . getContent ( ) ) ; writeEnd ( ) ; } | Writes a link in the header . |
5,222 | protected void writeJavaScript ( Header header ) throws IOException { addTabs ( 2 ) ; writeStart ( HtmlTags . SCRIPT ) ; write ( HtmlTags . LANGUAGE , HtmlTags . JAVASCRIPT ) ; if ( markup . size ( ) > 0 ) { writeMarkupAttributes ( markup ) ; os . write ( GT ) ; writeEnd ( HtmlTags . SCRIPT ) ; } else { write ( HtmlTag... | Writes a JavaScript section or if the markup attribute HtmlTags . URL is set a JavaScript reference in the header . |
5,223 | public boolean isOtherFont ( Font font ) { try { Font cFont = ( Font ) currentfont . peek ( ) ; if ( cFont . compareTo ( font ) == 0 ) return false ; return true ; } catch ( EmptyStackException ese ) { if ( standardfont . compareTo ( font ) == 0 ) return false ; return true ; } } | Checks if a given font is the same as the font that was last used . |
5,224 | protected void writeSection ( Section section , int indent ) throws IOException { if ( section . getTitle ( ) != null ) { int depth = section . getDepth ( ) - 1 ; if ( depth > 5 ) { depth = 5 ; } Properties styleAttributes = new Properties ( ) ; if ( section . getTitle ( ) . hasLeading ( ) ) styleAttributes . setProper... | Writes the HTML representation of a section . |
5,225 | protected void writeCssProperty ( String prop , String value ) throws IOException { write ( new StringBuffer ( prop ) . append ( ": " ) . append ( value ) . append ( "; " ) . toString ( ) ) ; } | Writes out a CSS property . |
5,226 | public static byte [ ] getBarsInter25 ( String text ) { text = keepNumbers ( text ) ; if ( ( text . length ( ) & 1 ) != 0 ) throw new IllegalArgumentException ( "The text length must be even." ) ; byte bars [ ] = new byte [ text . length ( ) * 5 + 7 ] ; int pb = 0 ; bars [ pb ++ ] = 0 ; bars [ pb ++ ] = 0 ; bars [ pb +... | Creates the bars for the barcode . |
5,227 | private void init ( FileChannel channel , FileChannel . MapMode mapMode ) throws IOException { this . channel = channel ; this . mappedByteBuffer = channel . map ( mapMode , 0L , channel . size ( ) ) ; mappedByteBuffer . load ( ) ; } | initializes the channel and mapped bytebuffer |
5,228 | public static boolean clean ( final java . nio . ByteBuffer buffer ) { if ( buffer == null || ! buffer . isDirect ( ) ) { return false ; } if ( cleanJava9 ( buffer ) ) { return true ; } return cleanOldsJDK ( buffer ) ; } | invokes the clean method on the ByteBuffer s cleaner |
5,229 | public static PdfAppearance createAppearance ( PdfWriter writer , float width , float height ) { return createAppearance ( writer , width , height , null ) ; } | Creates a new appearance to be used with form fields . |
5,230 | public MarkedSection addMarkedSection ( ) { MarkedSection section = new MarkedSection ( new Section ( null , numberDepth + 1 ) ) ; add ( section ) ; return section ; } | Adds a marked section . For use in class MarkedSection only! |
5,231 | public static Paragraph constructTitle ( Paragraph title , ArrayList numbers , int numberDepth , int numberStyle ) { if ( title == null ) { return null ; } int depth = Math . min ( numbers . size ( ) , numberDepth ) ; if ( depth < 1 ) { return title ; } StringBuffer buf = new StringBuffer ( " " ) ; for ( int i = 0 ; i ... | Constructs a Paragraph that will be used as title for a Section or Chapter . |
5,232 | public void setChapterNumber ( int number ) { numbers . set ( numbers . size ( ) - 1 , Integer . valueOf ( number ) ) ; Object s ; for ( Iterator i = iterator ( ) ; i . hasNext ( ) ; ) { s = i . next ( ) ; if ( s instanceof Section ) { ( ( Section ) s ) . setChapterNumber ( number ) ; } } } | Changes the Chapter number . |
5,233 | private void setNumbers ( int number , ArrayList numbers ) { this . numbers = new ArrayList ( ) ; this . numbers . add ( Integer . valueOf ( number ) ) ; this . numbers . addAll ( numbers ) ; } | Sets the number of this section . |
5,234 | public void setViewerPreferences ( int preferences ) { this . pageLayoutAndMode |= preferences ; if ( ( preferences & viewerPreferencesMask ) != 0 ) { pageLayoutAndMode = ~ viewerPreferencesMask & pageLayoutAndMode ; if ( ( preferences & PdfWriter . HideToolbar ) != 0 ) viewerPreferences . put ( PdfName . HIDETOOLBAR ,... | Sets the viewer preferences as the sum of several constants . |
5,235 | private boolean isPossibleValue ( PdfName value , PdfName [ ] accepted ) { for ( int i = 0 ; i < accepted . length ; i ++ ) { if ( accepted [ i ] . equals ( value ) ) { return true ; } } return false ; } | Checks if some value is valid for a certain key . |
5,236 | public void addViewerPreference ( PdfName key , PdfObject value ) { switch ( getIndex ( key ) ) { case 0 : case 1 : case 2 : case 3 : case 4 : case 5 : case 14 : if ( value instanceof PdfBoolean ) { viewerPreferences . put ( key , value ) ; } break ; case 6 : if ( value instanceof PdfName && isPossibleValue ( ( PdfName... | Sets the viewer preferences for printing . |
5,237 | public void addTitle ( String title ) { XmpArray array = new XmpArray ( XmpArray . ALTERNATIVE ) ; array . add ( title ) ; setProperty ( TITLE , array ) ; } | Adds a title . |
5,238 | public void addDescription ( String desc ) { XmpArray array = new XmpArray ( XmpArray . ALTERNATIVE ) ; array . add ( desc ) ; setProperty ( DESCRIPTION , array ) ; } | Adds a description . |
5,239 | public void addSubject ( String [ ] subject ) { XmpArray array = new XmpArray ( XmpArray . UNORDERED ) ; for ( int i = 0 ; i < subject . length ; i ++ ) { array . add ( subject [ i ] ) ; } setProperty ( SUBJECT , array ) ; } | Adds a subject . |
5,240 | public void addAuthor ( String author ) { XmpArray array = new XmpArray ( XmpArray . ORDERED ) ; array . add ( author ) ; setProperty ( CREATOR , array ) ; } | Adds a single author . |
5,241 | public void addPublisher ( String publisher ) { XmpArray array = new XmpArray ( XmpArray . ORDERED ) ; array . add ( publisher ) ; setProperty ( PUBLISHER , array ) ; } | Adds a single publisher . |
5,242 | protected char getCurrentCharacter ( int current , char [ ] cc , PdfChunk [ ] ck ) { if ( ck == null ) { return cc [ current ] ; } return ( char ) ck [ Math . min ( current , ck . length - 1 ) ] . getUnicodeEquivalent ( cc [ current ] ) ; } | Returns the current character |
5,243 | public void addElement ( Element element ) { if ( table != null ) { table = null ; column . setText ( null ) ; } column . addElement ( element ) ; } | Adds an iText element to the cell . |
5,244 | public void setImage ( Image image ) { column . setText ( null ) ; table = null ; this . image = image ; } | Setter for property image . |
5,245 | public void setCellEvent ( PdfPCellEvent cellEvent ) { if ( cellEvent == null ) this . cellEvent = null ; else if ( this . cellEvent == null ) this . cellEvent = cellEvent ; else if ( this . cellEvent instanceof PdfPCellEventForwarder ) ( ( PdfPCellEventForwarder ) this . cellEvent ) . addCellEvent ( cellEvent ) ; else... | Sets the cell event for this cell . |
5,246 | void consumeHeight ( float height ) { float rightLimit = getRight ( ) - getEffectivePaddingRight ( ) ; float leftLimit = getLeft ( ) + getEffectivePaddingLeft ( ) ; float bry = height - getEffectivePaddingTop ( ) - getEffectivePaddingBottom ( ) ; if ( getRotation ( ) != 90 && getRotation ( ) != 270 ) { column . setSimp... | Consumes part of the content of the cell . |
5,247 | public float getMaxHeight ( ) { boolean pivoted = ( getRotation ( ) == 90 || getRotation ( ) == 270 ) ; Image img = getImage ( ) ; if ( img != null ) { img . scalePercent ( 100 ) ; float refWidth = pivoted ? img . getScaledHeight ( ) : img . getScaledWidth ( ) ; float scale = ( getRight ( ) - getEffectivePaddingRight (... | Returns the height of the cell . |
5,248 | public Image getImage ( int frame ) { GifFrame gf = ( GifFrame ) frames . get ( frame - 1 ) ; return gf . image ; } | Gets the image from a frame . The first frame is 1 . |
5,249 | protected void readLSD ( ) throws IOException { width = readShort ( ) ; height = readShort ( ) ; int packed = in . read ( ) ; gctFlag = ( packed & 0x80 ) != 0 ; m_gbpc = ( packed & 7 ) + 1 ; bgIndex = in . read ( ) ; pixelAspect = in . read ( ) ; } | Reads Logical Screen Descriptor |
5,250 | protected void readImage ( ) throws IOException { ix = readShort ( ) ; iy = readShort ( ) ; iw = readShort ( ) ; ih = readShort ( ) ; int packed = in . read ( ) ; lctFlag = ( packed & 0x80 ) != 0 ; interlace = ( packed & 0x40 ) != 0 ; lctSize = 2 << ( packed & 7 ) ; m_bpc = newBpc ( m_gbpc ) ; if ( lctFlag ) { m_curr_t... | Reads next frame image |
5,251 | protected void readGraphicControlExt ( ) throws IOException { in . read ( ) ; int packed = in . read ( ) ; dispose = ( packed & 0x1c ) >> 2 ; if ( dispose == 0 ) { dispose = 1 ; } transparency = ( packed & 1 ) != 0 ; delay = readShort ( ) * 10 ; transIndex = in . read ( ) ; in . read ( ) ; } | Reads Graphics Control Extension values |
5,252 | public void mapRole ( PdfName used , PdfName standard ) { PdfDictionary rm = ( PdfDictionary ) get ( PdfName . ROLEMAP ) ; if ( rm == null ) { rm = new PdfDictionary ( ) ; put ( PdfName . ROLEMAP , rm ) ; } rm . put ( used , standard ) ; } | Maps the user tags to the standard tags . The mapping will allow a standard application to make some sense of the tagged document whatever the user tags may be . |
5,253 | private byte [ ] getContentBytesForPage ( int pageNum ) throws IOException { RandomAccessFileOrArray f = reader . getSafeFile ( ) ; byte [ ] contentBytes = reader . getPageContent ( pageNum , f ) ; f . close ( ) ; return contentBytes ; } | Gets the content stream of a page . |
5,254 | public String getTextFromPage ( int page ) throws IOException { int totalPages = reader . getNumberOfPages ( ) ; if ( totalPages < page ) { throw new IOException ( "indicated page does not exists, requested page " + page + " document pages " + totalPages ) ; } if ( page <= 0 ) { throw new IOException ( "page number mus... | Gets the text from a page . |
5,255 | public void readAcroForm ( PdfDictionary root ) { if ( root == null ) return ; hashMap = root . hashMap ; pushAttrib ( root ) ; PdfArray fieldlist = ( PdfArray ) PdfReader . getPdfObjectRelease ( root . get ( PdfName . FIELDS ) ) ; iterateFields ( fieldlist , null , null ) ; } | Read and comprehend the acroform |
5,256 | protected void iterateFields ( PdfArray fieldlist , PRIndirectReference fieldDict , String title ) { for ( Iterator it = fieldlist . listIterator ( ) ; it . hasNext ( ) ; ) { PRIndirectReference ref = ( PRIndirectReference ) it . next ( ) ; PdfDictionary dict = ( PdfDictionary ) PdfReader . getPdfObjectRelease ( ref ) ... | After reading we index all of the fields . Recursive . |
5,257 | protected PdfDictionary mergeAttrib ( PdfDictionary parent , PdfDictionary child ) { PdfDictionary targ = new PdfDictionary ( ) ; if ( parent != null ) targ . putAll ( parent ) ; for ( Iterator it = child . getKeys ( ) . iterator ( ) ; it . hasNext ( ) ; ) { PdfName key = ( PdfName ) it . next ( ) ; if ( key . equals (... | merge field attributes from two dictionaries |
5,258 | protected void pushAttrib ( PdfDictionary dict ) { PdfDictionary dic = null ; if ( ! stack . isEmpty ( ) ) { dic = ( PdfDictionary ) stack . get ( stack . size ( ) - 1 ) ; } dic = mergeAttrib ( dic , dict ) ; stack . add ( dic ) ; } | stack a level of dictionary . Merge in a dictionary from this level |
5,259 | PdfStream getFormXObject ( int pageNumber , int compressionLevel ) throws IOException { PdfDictionary page = reader . getPageNRelease ( pageNumber ) ; PdfObject contents = PdfReader . getPdfObjectRelease ( page . get ( PdfName . CONTENTS ) ) ; PdfDictionary dic = new PdfDictionary ( ) ; byte bout [ ] = null ; if ( cont... | Gets the content stream of a page as a PdfStream object . |
5,260 | static public String getDictionaryDetail ( PdfDictionary dic , int depth ) { StringBuffer builder = new StringBuffer ( ) ; builder . append ( '(' ) ; List subDictionaries = new ArrayList ( ) ; for ( Iterator i = dic . getKeys ( ) . iterator ( ) ; i . hasNext ( ) ; ) { PdfName key = ( PdfName ) i . next ( ) ; PdfObject ... | Shows the detail of a dictionary . |
5,261 | static public void listContentStreamForPage ( PdfReader reader , int pageNum , PrintWriter out ) throws IOException { out . println ( "==============Page " + pageNum + "====================" ) ; out . println ( "- - - - - Dictionary - - - - - -" ) ; PdfDictionary pageDictionary = reader . getPageN ( pageNum ) ; out . p... | Writes information about a specific page from PdfReader to the specified output stream . |
5,262 | static public void listContentStream ( File pdfFile , PrintWriter out ) throws IOException { PdfReader reader = new PdfReader ( pdfFile . getCanonicalPath ( ) ) ; int maxPageNum = reader . getNumberOfPages ( ) ; for ( int pageNum = 1 ; pageNum <= maxPageNum ; pageNum ++ ) { listContentStreamForPage ( reader , pageNum ,... | Writes information about each page in a PDF file to the specified output stream . |
5,263 | public static void main ( String [ ] args ) { try { if ( args . length < 1 || args . length > 3 ) { System . out . println ( "Usage: PdfContentReaderTool <pdf file> [<output file>|stdout] [<page num>]" ) ; return ; } PrintWriter writer = new PrintWriter ( System . out ) ; if ( args . length >= 2 ) { if ( args [ 1 ] . ... | Writes information about each page in a PDF file to the specified file or System . out . |
5,264 | public static Image getInstance ( int width , int height , byte [ ] data , byte [ ] globals ) { Image img = new ImgJBIG2 ( width , height , data , globals ) ; return img ; } | Creates a JBIG2 Image . |
5,265 | public static Image getInstance ( PRIndirectReference ref ) throws BadElementException { PdfDictionary dic = ( PdfDictionary ) PdfReader . getPdfObjectRelease ( ref ) ; int width = ( ( PdfNumber ) PdfReader . getPdfObjectRelease ( dic . get ( PdfName . WIDTH ) ) ) . intValue ( ) ; int height = ( ( PdfNumber ) PdfReader... | Reuses an existing image . |
5,266 | public void scaleAbsolute ( float newWidth , float newHeight ) { plainWidth = newWidth ; plainHeight = newHeight ; float [ ] matrix = matrix ( ) ; scaledWidth = matrix [ DX ] - matrix [ CX ] ; scaledHeight = matrix [ DY ] - matrix [ CY ] ; setWidthPercentage ( 0 ) ; } | Scale the image to an absolute width and an absolute height . |
5,267 | public void scaleAbsoluteWidth ( float newWidth ) { plainWidth = newWidth ; float [ ] matrix = matrix ( ) ; scaledWidth = matrix [ DX ] - matrix [ CX ] ; scaledHeight = matrix [ DY ] - matrix [ CY ] ; setWidthPercentage ( 0 ) ; } | Scale the image to an absolute width . |
5,268 | public void scaleAbsoluteHeight ( float newHeight ) { plainHeight = newHeight ; float [ ] matrix = matrix ( ) ; scaledWidth = matrix [ DX ] - matrix [ CX ] ; scaledHeight = matrix [ DY ] - matrix [ CY ] ; setWidthPercentage ( 0 ) ; } | Scale the image to an absolute height . |
5,269 | public void scalePercent ( float percentX , float percentY ) { plainWidth = ( getWidth ( ) * percentX ) / 100f ; plainHeight = ( getHeight ( ) * percentY ) / 100f ; float [ ] matrix = matrix ( ) ; scaledWidth = matrix [ DX ] - matrix [ CX ] ; scaledHeight = matrix [ DY ] - matrix [ CY ] ; setWidthPercentage ( 0 ) ; } | Scale the width and height of an image to a certain percentage . |
5,270 | public void scaleToFit ( float fitWidth , float fitHeight ) { scalePercent ( 100 ) ; float percentX = ( fitWidth * 100 ) / getScaledWidth ( ) ; float percentY = ( fitHeight * 100 ) / getScaledHeight ( ) ; scalePercent ( percentX < percentY ? percentX : percentY ) ; setWidthPercentage ( 0 ) ; } | Scales the image so that it fits a certain width and height . |
5,271 | public float [ ] matrix ( ) { float [ ] matrix = new float [ 8 ] ; float cosX = ( float ) Math . cos ( rotationRadians ) ; float sinX = ( float ) Math . sin ( rotationRadians ) ; matrix [ AX ] = plainWidth * cosX ; matrix [ AY ] = plainWidth * sinX ; matrix [ BX ] = ( - plainHeight ) * sinX ; matrix [ BY ] = plainHeigh... | Returns the transformation matrix of the image . |
5,272 | public float getImageRotation ( ) { double d = 2.0 * Math . PI ; float rot = ( float ) ( ( rotationRadians - initialRotation ) % d ) ; if ( rot < 0 ) { rot += d ; } return rot ; } | Gets the current image rotation in radians . |
5,273 | public void setRotation ( float r ) { double d = 2.0 * Math . PI ; rotationRadians = ( float ) ( ( r + initialRotation ) % d ) ; if ( rotationRadians < 0 ) { rotationRadians += d ; } float [ ] matrix = matrix ( ) ; scaledWidth = matrix [ DX ] - matrix [ CX ] ; scaledHeight = matrix [ DY ] - matrix [ CY ] ; } | Sets the rotation of the image in radians . |
5,274 | public void simplifyColorspace ( ) { if ( additional == null ) return ; PdfArray value = additional . getAsArray ( PdfName . COLORSPACE ) ; if ( value == null ) return ; PdfObject cs = simplifyColorspace ( value ) ; PdfObject newValue ; if ( cs . isName ( ) ) newValue = cs ; else { newValue = value ; PdfName first = va... | Replaces CalRGB and CalGray colorspaces with DeviceRGB and DeviceGray . |
5,275 | private PdfObject simplifyColorspace ( PdfArray obj ) { if ( obj == null ) return obj ; PdfName first = obj . getAsName ( 0 ) ; if ( PdfName . CALGRAY . equals ( first ) ) return PdfName . DEVICEGRAY ; else if ( PdfName . CALRGB . equals ( first ) ) return PdfName . DEVICERGB ; else return obj ; } | Gets a PDF Name from an array or returns the object that was passed . |
5,276 | public void setImageMask ( Image mask ) throws DocumentException { if ( this . mask ) throw new DocumentException ( "An image mask cannot contain another image mask." ) ; if ( ! mask . mask ) throw new DocumentException ( "The image mask is not a mask. Did you do makeMask()?" ) ; imageMask = mask ; smask = ( mask . bpc... | Sets the explicit masking . |
5,277 | public void writeContent ( final OutputStream out ) throws IOException { final byte [ ] contentBytes = DocWriter . getISOBytes ( this . directContent ) ; out . write ( contentBytes ) ; } | Writes the element content to the given output stream . |
5,278 | public void setParser ( RtfParser parser ) { if ( this . rtfParser != null && this . rtfParser . equals ( parser ) ) return ; this . rtfParser = parser ; } | Set the parser to use with the RtfDestination object . |
5,279 | protected void writeFieldResultContent ( final OutputStream out ) throws IOException { document . filterSpecialChar ( out , defaultText , true , true ) ; } | Writes the field result content |
5,280 | public void writeContent ( final OutputStream result ) throws IOException { if ( this . background != null ) { result . write ( OPEN_GROUP ) ; } this . font . writeBegin ( result ) ; if ( superSubScript < 0 ) { result . write ( FONT_SUBSCRIPT ) ; } else if ( superSubScript > 0 ) { result . write ( FONT_SUPERSCRIPT ) ; ... | Writes the content of this RtfChunk . First the font information is written then the content and then more font information |
5,281 | public void setHeader ( HeaderFooter header ) { this . header = header ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . setHeader ( header ) ; } } | Changes the header of this document . |
5,282 | public void resetHeader ( ) { this . header = null ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . resetHeader ( ) ; } } | Resets the header of this document . |
5,283 | public void setFooter ( HeaderFooter footer ) { this . footer = footer ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . setFooter ( footer ) ; } } | Changes the footer of this document . |
5,284 | public void resetFooter ( ) { this . footer = null ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . resetFooter ( ) ; } } | Resets the footer of this document . |
5,285 | public void resetPageCount ( ) { pageN = 0 ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . resetPageCount ( ) ; } } | Sets the page number to 0 . |
5,286 | public void setPageCount ( int pageN ) { this . pageN = pageN ; DocListener listener ; for ( Iterator iterator = listeners . iterator ( ) ; iterator . hasNext ( ) ; ) { listener = ( DocListener ) iterator . next ( ) ; listener . setPageCount ( pageN ) ; } } | Sets the page number . |
5,287 | public boolean addHeader ( String name , String content ) { try { return add ( new Header ( name , content ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds a user defined header to the document . |
5,288 | public boolean addTitle ( String title ) { try { return add ( new Meta ( Element . TITLE , title ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the title to a Document . |
5,289 | public boolean addSubject ( String subject ) { try { return add ( new Meta ( Element . SUBJECT , subject ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the subject to a Document . |
5,290 | public boolean addKeywords ( String keywords ) { try { return add ( new Meta ( Element . KEYWORDS , keywords ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the keywords to a Document . |
5,291 | public boolean addAuthor ( String author ) { try { return add ( new Meta ( Element . AUTHOR , author ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the author to a Document . |
5,292 | public boolean addCreator ( String creator ) { try { return add ( new Meta ( Element . CREATOR , creator ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the creator to a Document . |
5,293 | public boolean addProducer ( ) { try { return add ( new Meta ( Element . PRODUCER , getVersion ( ) ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the producer to a Document . |
5,294 | public boolean addCreationDate ( ) { try { final SimpleDateFormat sdf = new SimpleDateFormat ( "EEE MMM dd HH:mm:ss zzz yyyy" ) ; return add ( new Meta ( Element . CREATIONDATE , sdf . format ( new Date ( ) ) ) ) ; } catch ( DocumentException de ) { throw new ExceptionConverter ( de ) ; } } | Adds the current date and time to a Document . |
5,295 | public static byte [ ] getBarsPostnet ( String text ) { int total = 0 ; for ( int k = text . length ( ) - 1 ; k >= 0 ; -- k ) { int n = text . charAt ( k ) - '0' ; total += n ; } text += ( char ) ( ( ( 10 - ( total % 10 ) ) % 10 ) + '0' ) ; byte bars [ ] = new byte [ text . length ( ) * 5 + 2 ] ; bars [ 0 ] = 1 ; bars ... | Creates the bars for Postnet . |
5,296 | public PdfAppearance getAppearance ( boolean isRadio , boolean on ) throws IOException , DocumentException { if ( isRadio && checkType == TYPE_CIRCLE ) return getAppearanceRadioCircle ( on ) ; PdfAppearance app = getBorderAppearance ( ) ; if ( ! on ) return app ; BaseFont ufont = getRealFont ( ) ; boolean borderExtra =... | Gets the field appearance . |
5,297 | public PdfAppearance getAppearanceRadioCircle ( boolean on ) { PdfAppearance app = PdfAppearance . createAppearance ( writer , box . getWidth ( ) , box . getHeight ( ) ) ; switch ( rotation ) { case 90 : app . setMatrix ( 0 , 1 , - 1 , 0 , box . getHeight ( ) , 0 ) ; break ; case 180 : app . setMatrix ( - 1 , 0 , 0 , -... | Gets the special field appearance for the radio circle . |
5,298 | protected PdfFormField getField ( boolean isRadio ) throws IOException , DocumentException { PdfFormField field = null ; if ( isRadio ) field = PdfFormField . createEmpty ( writer ) ; else field = PdfFormField . createCheckBox ( writer ) ; field . setWidget ( box , PdfAnnotation . HIGHLIGHT_INVERT ) ; if ( ! isRadio ) ... | Gets a radio or check field . |
5,299 | private void populateOperators ( ) { operators = new HashMap ( ) ; registerContentOperator ( "q" , new PushGraphicsState ( ) ) ; registerContentOperator ( "Q" , new PopGraphicsState ( ) ) ; registerContentOperator ( "cm" , new ModifyCurrentTransformationMatrix ( ) ) ; registerContentOperator ( "gs" , new ProcessGraphic... | Loads all the supported graphics and text state operators in a map . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.