protected PdfObject copyObject ( PdfObject in ) throws IOException , BadPdfFormatException { if ( in == null ) return PdfNull . PDFNULL ; switch ( in . type ) { case PdfObject . DICTIONARY : // System.out.println("Dictionary: " + in.toString()); return copyDictionary ( ( PdfDictionary ) in ) ; case PdfObject . INDIRECT : return copyIndirect ( ( PRIndirectReference ) in ) ; case PdfObject . ARRAY : return copyArray ( ( PdfArray ) in ) ; case PdfObject . NUMBER : case PdfObject . NAME : case PdfObject . STRING : case PdfObject . NULL : case PdfObject . BOOLEAN : case 0 : return in ; case PdfObject . STREAM : return copyStream ( ( PRStream ) in ) ; // return in; default : if ( in . type < 0 ) { String lit = ( ( PdfLiteral ) in ) . toString ( ) ; if ( lit . equals ( "true" ) || lit . equals ( "false" ) ) { return new PdfBoolean ( lit ) ; } return new PdfLiteral ( lit ) ; } System . out . println ( "CANNOT COPY type " + in . type ) ; return null ; } }
Translate a PR - object to a Pdf - object