Do you get the same results with "new PdfReader( new
RandomAccessFileOrArray( myFile.getAbsolutePath() ) )"?

You're using two different paths, which could (unlikely but possible)
cause a difference.

--Mark Storer
  Senior Software Engineer
  Cardiff.com
 
import legalese.Disclaimer;
Disclaimer<Cardiff> DisCard = null;
 
 

> -----Original Message-----
> From: sterlpearl [mailto:[email protected]] 
> Sent: Friday, October 22, 2010 3:18 AM
> To: [email protected]
> Subject: [iText-questions] RandomFileOrAccessArray
> 
> 
> When I invoke the addColorBarLower method below, the 
> pdfContentByte is typically generated by code like:
> 
> PdfReader cardReader = new PdfReader(myFile.getAbsolutePath());
> //PdfReader cardReader = new PdfReader(new 
> RandomAccessFileOrArray(cardTempFile.getAbsolutePath()), 
> null); PdfImportedPage importedPage = 
> copy.getImportedPage(cardReader, i); PdfCopy.PageStamp 
> cardStamp = copy.createPageStamp(importedPage);
> PdfContentByte over = cardStamp.getOverContent();
> 
> The code works fine as is to add a color bar with some text 
> to a page in an existing PDF, but if I comment the first 
> instantiation of the cardReader object and uncomment the 
> second, I do not see the color bar. Am I doing something wrong?
> 
> public static void addColorBarLower(PdfContentByte 
> pdfContentByte, String mixId, int currentQuantity, int 
> totalQuantity, int currentPage, int pageCount, Rectangle 
> pageSize) throws IOException, DocumentException {
>         float colorBarHeight = pageSize.getHeight() / 2;
> 
>         PdfTemplate template = 
> pdfContentByte.createTemplate(colorBarHeight,
> COLOR_BAR_WIDTH); //Inverted because of rotation
>         String slug = mixId + " Set " + currentQuantity + " 
> of " + totalQuantity + " Page " + currentPage + " of " + pageCount;
>         Rectangle rectangle = new Rectangle(0, 0, 
> colorBarHeight, COLOR_BAR_WIDTH);
>         if (currentQuantity % 2 == 0) { //Even set
>             rectangle.setBackgroundColor(COLOR_BAR_LOWER_EVEN);
>         } else { //Odd set
>             rectangle.setBackgroundColor(COLOR_BAR_LOWER_ODD);
>         }
>         template.rectangle(rectangle);
>         template.beginText();
>         template.setFontAndSize(BaseFont.createFont(COLOR_BAR_FONT,
> COLOR_BAR_ENCODING, false), COLOR_BAR_FONT_SIZE);
>         template.showTextAligned(PdfTemplate.ALIGN_LEFT, 
> slug.toUpperCase(), COLOR_BAR_INSET, COLOR_BAR_INSET, 0);
>         template.endText();
>         Image colorBar = Image.getInstance(template);
>         colorBar.setRotationDegrees(COLOR_BAR_DEG_ROTATE);
>         colorBar.setAbsolutePosition(0, 0);
>         pdfContentByte.addImage(colorBar);
>     }
> --
> View this message in context: 
> http://itext-general.2136553.n4.nabble.com/RandomFileOrAccessA
> rray-tp3006930p3006930.html
> Sent from the iText - General mailing list archive at Nabble.com.
> 
> --------------------------------------------------------------
> ----------------
> Nokia and AT&T present the 2010 Calling All Innovators-North 
> America contest Create new apps & games for the Nokia N8 for 
> consumers in  U.S. and Canada $10 million total in prizes - 
> $4M cash, 500 devices, nearly $6M in marketing Develop with 
> Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
> http://p.sf.net/sfu/nokia-dev2dev 
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> 
> Many questions posted to this list can (and will) be answered 
> with a reference to the iText book: 
> http://www.itextpdf.com/book/ Please check the keywords list 
> before you ask for examples: http://itextpdf.com/themes/keywords.php
> 
> 

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to