Package org.apache.pdfbox.pdfwriter

Examples of org.apache.pdfbox.pdfwriter.ContentStreamWriter.writeTokens()


                    ByteArrayOutputStream output = new ByteArrayOutputStream();
                    // BJL 9/25/2004 Must prepend existing stream
                    // because it might have operators to draw things like
                    // rectangles and such
                    ContentStreamWriter writer = new ContentStreamWriter(output);
                    writer.writeTokens(tokens);
                    output.write(" /Tx BMC\n".getBytes("ISO-8859-1"));
                    insertGeneratedAppearance(widget, output, pdFont, tokens, appearanceStream);
                    output.write(" EMC".getBytes("ISO-8859-1"));
                    writeToStream(output.toByteArray(), appearanceStream);
                }
View Full Code Here


                        int bmcIndex = tokens.indexOf(Operator.getOperator("BMC"));
                        int emcIndex = tokens.indexOf(Operator.getOperator("EMC"));

                        if (bmcIndex != -1)
                        {
                            writer.writeTokens(tokens, 0, bmcIndex + 1);
                        }
                        else
                        {
                            writer.writeTokens(tokens);
                        }
View Full Code Here

                        {
                            writer.writeTokens(tokens, 0, bmcIndex + 1);
                        }
                        else
                        {
                            writer.writeTokens(tokens);
                        }
                        output.write("\n".getBytes("ISO-8859-1"));
                        insertGeneratedAppearance(widget, output, pdFont, tokens, appearanceStream);
                        if (emcIndex != -1)
                        {
View Full Code Here

                        }
                        output.write("\n".getBytes("ISO-8859-1"));
                        insertGeneratedAppearance(widget, output, pdFont, tokens, appearanceStream);
                        if (emcIndex != -1)
                        {
                            writer.writeTokens(tokens, emcIndex, tokens.size());
                        }
                        writeToStream(output.toByteArray(), appearanceStream);
                    }
                    else
                    {
View Full Code Here

            if (fontIndex != -1)
            {
                daTokens.set(fontIndex - 1, new COSFloat(fontSize));
            }
            ContentStreamWriter daWriter = new ContentStreamWriter(output);
            daWriter.writeTokens(daTokens);
        }

        PDRectangle borderEdge = getSmallestDrawnRectangle(boundingBox, tokens);

        // Acrobat calculates the left and right padding dependent on the offset of the border edge
View Full Code Here

                        newTokens.add( token );

                    }
                    PDStream newContents = new PDStream( document );
                    ContentStreamWriter writer = new ContentStreamWriter( newContents.createOutputStream() );
                    writer.writeTokens( newTokens );
                    newContents.addCompression();
                    page.setContents( newContents );
                }
                document.save( args[1] );
            }
View Full Code Here

                    //BJL 9/25/2004 Must prepend existing stream
                    //because it might have operators to draw things like
                    //rectangles and such
                    ContentStreamWriter writer = new ContentStreamWriter( output );
                    writer.writeTokens( tokens );

                    output.write( " /Tx BMC\n".getBytes("ISO-8859-1") );
                    insertGeneratedAppearance( widget, output, pdFont, tokens, appearanceStream );
                    output.write( " EMC".getBytes("ISO-8859-1") );
                    writeToStream( output.toByteArray(), appearanceStream );
View Full Code Here

                        }
                        int setFontIndex = tokens.indexOf( PDFOperator.getOperator( "Tf" ));
                        tokens.set( setFontIndex-1, new COSFloat( fontSize ) );
                        if( foundString )
                        {
                            writer.writeTokens( tokens );
                        }
                        else
                        {
                            int bmcIndex = tokens.indexOf( PDFOperator.getOperator( "BMC" ) );
                            int emcIndex = tokens.indexOf( PDFOperator.getOperator( "EMC" ) );
View Full Code Here

                            int bmcIndex = tokens.indexOf( PDFOperator.getOperator( "BMC" ) );
                            int emcIndex = tokens.indexOf( PDFOperator.getOperator( "EMC" ) );

                            if( bmcIndex != -1 )
                            {
                                writer.writeTokens( tokens, 0, bmcIndex+1 );
                            }
                            else
                            {
                                writer.writeTokens( tokens );
                            }
View Full Code Here

                            {
                                writer.writeTokens( tokens, 0, bmcIndex+1 );
                            }
                            else
                            {
                                writer.writeTokens( tokens );
                            }
                            output.write( "\n".getBytes("ISO-8859-1") );
                            insertGeneratedAppearance( widget, output,
                                pdFont, tokens, appearanceStream );
                            if( emcIndex != -1 )
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.