I'm trying to do a simple task of scaling down a PDF. I found two samples on
the Internet that demonstrate exactly what I want, but when I try to compile
the code I get an error. It says it can't find the symbol for the
addTemplate method, but the method call looks correct to me according to the
API documentation. What am I doing wrong? This is the code and the error:

import java.io.*;
import com.itextpdf.text.pdf.*;
import com.itextpdf.text.*;

class TestProg {
  public static void main( String[] args ) throws Exception {
    PdfReader reader = new PdfReader( "test.pdf" );
    Rectangle inRect = reader.getPageSize( 1 );
    Document outDoc = new Document( inRect );
    PdfWriter writer = PdfWriter.getInstance( outDoc, new FileOutputStream(
"test-scaled.pdf", false ) );
    outDoc.open();
    PdfContentByte cb = writer.getDirectContent();
    PdfImportedPage page = writer.getImportedPage( reader, 1 );
    cb.addTemplate( page, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0 );
    outDoc.close();
  }
}

javac.exe -classpath iText-5.0.1.jar TestProg.java
TestProg.java:14: cannot find symbol
symbol  : method
addTemplate(com.itextpdf.text.pdf.PdfImportedPage,double,double,double,double,double,double)
location: class com.itextpdf.text.pdf.PdfContentByte
                cb.addTemplate( page, 0.1, 0.0, 0.0, 0.1, 0.0, 0.0 );
                  ^
1 error


Thanks.
-- 
View this message in context: 
http://old.nabble.com/Can%27t-get-PdfContentByte.addTemplate-to-work-tp27540200p27540200.html
Sent from the iText - General mailing list archive at Nabble.com.


------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-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