Not sure if this is the answer, but I don't understand why you say that the
showTextAligned() uses integers. In fact, it uses floating-point values. See
the Javadoc
http://1t3xt.info/api/com/lowagie/text/pdf/PdfContentByte.html#showTextAligned(int,%20java.lang.String,%20float,%20float,%20float,%20boolean)

Likewise, setFontAndSize() takes a floating-point value. Again, look at the
JavaDoc.

I suspect that you can tweak the values to fit perfectly.

---mr. bean

>>> re >>>


Stepan RYBAR wrote:
> 
> Hello, 
> 
> I have a problem using FOP 0.95 and iText 2.1.3 for exact overprint. I
> have FO file (see attached FO) with 72 dpi in configuration file, which
> creates the first PDF: 
> 
> <fo:block-container absolute-position="fixed" top="100pt" left="100pt"
> height="20pt" width="100pt" reference-orientation="90">
>  <fo:block font-size="10pt" font-family="Courier New">+1010-</fo:block>
> </fo:block-container>
> 
> Then I have Java file (see attached Java) with iText code, which uses the
> first PDF, add some (now overprinted) text and creates the second PDF: 
> 
> over.showTextAligned(Element.ALIGN_LEFT, "+1011-", 108, 642, 90);
> 
> Both FOP and iText uses the same font. I am not able to do exact overprint
> of "+101.-" chars (see attached PNG) using just only setting iText, even
> when I iterate x and y axis value point-by-point. As far as I know, I have
> to use points as INTEGER in case of iText. Is it reasonable to change
> position values from INTEGER to let say DECIMAL? Because in FOP I am able
> to use 99.9pt and it is different position than 100pt (so I have a
> workaround now). I need it for composing barcode OMR. FOP is able do print
> the first part of the barcode, while iText is the able to print the rest
> of barcode (btw.I am solving problem of logical and physical page counting
> and control digit at the end of barcode). Also both PDF files are
> attached. Hope, that this my problem and request does not sound too crazy
> ;-) 
> 
> Or the best answer for me is, that I made something wrong using FOP or
> iText and I do need to set FOP X-value for 99.9pt. 
> 
> Thank You in advance. Stepan
> <?xml version="1.0" encoding="utf-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
>   <fo:layout-master-set>
>     <fo:simple-page-master master-name="chapter" page-height="297mm"
> page-width="210mm" margin="0cm">
>       <fo:region-body margin="2cm" />
>       <fo:region-end extent="2cm" />
>     </fo:simple-page-master>
>   </fo:layout-master-set>
>   <fo:page-sequence master-reference="chapter">
>     <fo:static-content flow-name="xsl-region-end">
>       <fo:block-container>
>         <fo:block-container absolute-position="fixed" top="100pt"
> left="100pt" height="20pt" width="100pt" reference-orientation="90">
>           <fo:block font-size="10pt" font-family="Courier
> New">+1010-</fo:block>
>         </fo:block-container>
>       </fo:block-container>
>     </fo:static-content>
>     <fo:flow flow-name="xsl-region-body">
>       <fo:block>ZACATEK VYPISU</fo:block>
>     </fo:flow>
>   </fo:page-sequence>
> </fo:root>
> 
>  
> import java.io.FileOutputStream;
> 
> import com.lowagie.text.Element;
> import com.lowagie.text.pdf.BaseFont;
> import com.lowagie.text.pdf.PdfContentByte;
> import com.lowagie.text.pdf.PdfReader;
> import com.lowagie.text.pdf.PdfStamper;
> 
> public class AddPageNumbersToExistingPageNumberPDF {
>   public static void main(String[] args) {
>     try {
>       PdfReader reader = new PdfReader(args[0]);
>       int n = reader.getNumberOfPages();
>       //System.out.println(n);
> 
>       PdfStamper stamp = new PdfStamper(reader, new
> FileOutputStream(args[1]));
>       int i = 0;
>       PdfContentByte over;
>       BaseFont bf = BaseFont.createFont("C:\\Program Files\\Apache FOP
> 0.95\\fonts\\cour.ttf", BaseFont.WINANSI, BaseFont.EMBEDDED);
>       while (i < n) {
>         i++;
>         over = stamp.getOverContent(i);
>         over.beginText();
>         over.setFontAndSize(bf, 10);
>         //over.setTextMatrix(10, 10);
>         over.showTextAligned(Element.ALIGN_LEFT, "+1011-", 108, 642, 90);
>         over.endText();
>       }
>       stamp.close();
> 
>     } catch (Exception de) {
>       de.printStackTrace();
>     }
>   }
> }
>  
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the
> world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> 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
> 

-- 
View this message in context: 
http://www.nabble.com/FOP-0.95-and-iText-2.1.3-unable-to-do-exact-overprint-tp20458311p20475741.html
Sent from the iText - General mailing list archive at Nabble.com.


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
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

Reply via email to