If I replace the line

    cb.addTemplate(page1, 1, 0, 0, 1, 0, 0);

with this line

    document.add(Image.getInstance(page1));

the text content is displayed on the next page. Can a Paragraph object 
be layered over an Image object somehow?

Harri

On 11.11.2009 02:42 Mark Storer wrote:
> In both files, the imported page is drawn /after/ (on top of) the text.
>
> I believe you can wrap an imported page in an Image and add it to the 
> document that way instead of through the page's direct content.
>
> --Mark Storer 
>   Senior Software Engineer 
>   Cardiff.com
>
> #include <disclaimer> 
> typedef std::Disclaimer<Cardiff> DisCard; 
>
>
>
>   
>> -----Original Message-----
>> From: Harri T. [mailto:haba...@gmail.com]
>> Sent: Tuesday, November 10, 2009 4:09 PM
>> To: itext-questions@lists.sourceforge.net
>> Subject: Re: [iText-questions] Merging content with a pdf created
>> withOpenOffice.org Draw
>>
>>
>> Hi Mark! See the files here: 
>> http://sites.google.com/site/haba713/itext-issue
>>
>> test004 - OO3.1 Writer
>> test005 - OO3.1 Draw
>>
>> iText version is 2.1.7.
>>
>> Harri
>>
>> On 10.11.2009 23:57 Mark Storer wrote:
>>     
>>> Please post the files from Writer and Draw, as well as the 
>>>       
>> output from your program.
>>     
>>> PS: Which version of iText are you using.
>>>
>>> --Mark Storer 
>>>   Senior Software Engineer 
>>>   Cardiff.com
>>>
>>> #include <disclaimer> 
>>> typedef std::Disclaimer<Cardiff> DisCard; 
>>>
>>>
>>>
>>>   
>>>       
>>>> -----Original Message-----
>>>> From: Harri T. [mailto:haba...@gmail.com]
>>>> Sent: Tuesday, November 10, 2009 12:44 PM
>>>> To: itext-questions@lists.sourceforge.net
>>>> Subject: [iText-questions] Merging content with a pdf created
>>>> withOpenOffice.org Draw
>>>>
>>>>
>>>> Hi! I should implement a program that uses PDF document as 
>>>>         
>> a template 
>>     
>>>> and adds content from text file over the template. The current 
>>>> implementation below works if template is made with OO3 
>>>> Writer. However, 
>>>> if the template pdf is created with OO3 Draw, only the 
>>>> template content 
>>>> is displayed in the resulting pdf.
>>>>
>>>> I tried also layers but result is the same. Even if the 
>>>> template is in a 
>>>> "lower" layer and text content in a "higher" layer, the text 
>>>> content is 
>>>> displayed in Adobe Reader only if the lower layer is hidden.
>>>>
>>>> So, how should I change the program to make work also with 
>>>>         
>> a template 
>>     
>>>> pdf created with OO3 Draw?
>>>>
>>>> Harri
>>>>
>>>>     public static void main(String[] args) throws Exception {
>>>>         if (args.length != 3) {
>>>>             System.err.println("Usage: java -jar merge.jar 
>>>> pdf_in txt_in pdf_out");
>>>>         }
>>>>         String pdfIn = args[0];
>>>>         String textIn = args[1];
>>>>         String pdfOut = args[2];
>>>>
>>>>         PdfReader reader = new PdfReader(pdfIn);
>>>>         Document document = new Document(PageSize.A4);
>>>>         PdfWriter writer = PdfWriter.getInstance(document, 
>>>> new FileOutputStream(pdfOut));
>>>>         document.open();
>>>>         PdfContentByte cb = writer.getDirectContent();
>>>>
>>>>         document.newPage();
>>>>
>>>>         PdfImportedPage page1 = writer.getImportedPage(reader, 1);
>>>>         cb.addTemplate(page1, 1, 0, 0, 1, 0, 0);
>>>>
>>>>         Paragraph paragraph = new Paragraph();
>>>>         paragraph.setLeading(0.5f, 0.5f);
>>>>         File file = new File(textIn);
>>>>         BufferedReader in = new BufferedReader(new 
>>>>         
>> FileReader(file));
>>     
>>>>         String line;
>>>>         StringBuffer buffer = new StringBuffer((int) 
>>>>         
>> file.length());
>>     
>>>>         while ((line = in.readLine()) != null) {
>>>>             buffer.append(line);
>>>>             buffer.append('\n');
>>>>         }
>>>>         paragraph.add(new Chunk(buffer.toString(), new 
>>>> Font(Font.COURIER, 7, Font.NORMAL)));
>>>>         document.add(paragraph);
>>>>
>>>>         document.close();
>>>>     }
>>>>
>>>>
>>>> --------------------------------------------------------------
>>>> ----------------
>>>> Let Crystal Reports handle the reporting - Free Crystal 
>>>> Reports 2008 30-Day 
>>>> trial. Simplify your report design, integration and 
>>>> deployment - and focus on 
>>>> what you do best, core application coding. Discover what's new with
>>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>>> _______________________________________________
>>>> iText-questions mailing list
>>>> iText-questions@lists.sourceforge.net
>>>> 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/
>>     
>>>
>>>       
>> --------------------------------------------------------------
>> ----------------
>>     
>>> Let Crystal Reports handle the reporting - Free Crystal 
>>>       
>> Reports 2008 30-Day 
>>     
>>> trial. Simplify your report design, integration and 
>>>       
>> deployment - and focus on 
>>     
>>> what you do best, core application coding. Discover what's new with
>>> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
>>> _______________________________________________
>>> iText-questions mailing list
>>> iText-questions@lists.sourceforge.net
>>> 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/
>>   
>>     
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> 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/
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
> trial. Simplify your report design, integration and deployment - and focus on 
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> iText-questions mailing list
> iText-questions@lists.sourceforge.net
> 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/
>   


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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