Hey all,

I'm currently trying to create a new PDF file from an existing PDF. Thats
working fine but for some reason PDF's for w4, w9, etc are causing my PDF's
to be "choppy" or "laggy".

An example:
Original: http://www.irs.gov/pub/irs-pdf/fw9.pdf
Output: http://www.mediafire.com/?ejdozqtmcto

In the output document in Adobe reader, you'll notice when scrolling through
the pages the pages start off blank and then the content just "appears". The
only thing I can think of it's because there is hidden text in both PDF's
that "bleeding" outside the page. The thing is the original document has
this also, so I don't see why it's not laggy and the new one is. The code
I'm using is the following:

PdfReader reader = new PdfReader( "fw9_original.pdf" );

Document document = Document( reader.getPageSizeWithRotation( 1 ) );

PdfWriter writer = null;
try {
        writer = PdfWriter.getInstance( document, new FileOutputStream(
"fw9_output.pdf" ) );

        document.open();
        PdfContentByte content = writer.getDirectContent();

        int pages = reader.getNumberOfPages();
        for ( int i = 1; i <= pages; ++i ) {

                Rectangle margins = reader.getBoxSize( i, "media" );

                Rectangle sizes = reader.getPageSizeWithRotation( i );

                Image page = Image.getInstance( writer.getImportedPage( reader, 
i ) );
                page.setAbsolutePosition( margins.getLeft(), 
margins.getBottom() );
                page.setRotationDegrees( -sizes.getRotation() );

                content.addImage( page );
                document.newPage();
        }
        
} catch ( Exception e ) {
        System.out.println( e.toString() );
} finally {
        if ( null != document ) {
                try { document.close(); } catch ( Exception e ) { }
        }

        if ( null != writer ) {
                try { writer.close(); } catch ( Exception e ) { }
        }
}

Any ideas what this could be and if it is the hidden text can anyone point
me into the right direction to fixing it? All I'm trying to do is create a
new copy of the PDF with just the content, everything else "stripped" out of
it. Maybe it would be easier to just remove stuff from the original PDF and
save that.
-- 
View this message in context: 
http://old.nabble.com/PDF-%22laggy%22-because-of-bleeding--tp26755295p26755295.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Return on Information:
Google Enterprise Search pays you back
Get the facts.
http://p.sf.net/sfu/google-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Buy the iText book: http://www.1t3xt.com/docs/book.php
Check the site with examples before you ask questions: 
http://www.1t3xt.info/examples/
You can also search the keywords list: http://1t3xt.info/tutorials/keywords/

Reply via email to