Hi Bruno,
I've followed your comments and I imported 1 page of an A4 landscape PDF and
created 1 A5 portrait vertically splitted of A4. The C# code:
// source.pdf is A4 Landscape format
PdfReader reader = new PdfReader("source.pdf");
int n = reader.NumberOfPages;
iTextSharp.text.Rectangle psize =
reader.GetPageSize(1);
float width = psize.Width;
float height = psize.Height;
Document document = new Document(PageSize.A5);
// target.pdf is A5 Portrait format
PdfWriter writer =
PdfWriter.GetInstance(document, new
FileStream("target.pdf", FileMode.Create));
document.Open();
PdfContentByte cb = writer.DirectContent;
document.NewPage();
PdfImportedPage page1 =
writer.GetImportedPage(reader, 1);
cb.AddTemplate(page1, 1, 0, 0, 1, 0, 0);
// page1 created - an half of source A4
landscape page
--->Here follows the problem: I want to add second page of source and I
don't know how to setup the offset:
document.NewPage();
cb.AddTemplate(page1, A, B, C, D, E, F);
document.Close();
I'm a bit lost in the transformation matrix... Please, could you tell mi how
to setup the A,B,C,D,E and F values?
Thanks,
Pavol.
Bruno Lowagie (iText) wrote:
>
> sfunds wrote:
>> Hi,
>> I have a pdf file In which a page is divided into two vertical halves.
>
> Something like this:
> +--+--+
> | | |
> | | |
> +--+--+
> This is 1 page as far as PDF is concerned.
>
>>If I put view by page width the whole lengthwise doesnt appear.
>
> That would depend on the size of your reader window.
>
>> I need
>> to split the page vertically into 2 parts page 1A and page 1b
>> so that left part of page comes first and followed by right side of page
>
> Something like this:
> page 1:
> +--+
> | |
> | |
> +--+
> page 2:
> +--+
> | |
> | |
> +--+
>
>> Is it possible.
>
> Yes.
> Create a new Document with pages half the size of the
> original. Read the original document with PdfReader.
> Use PdfWriter.getImportedPage, and add the same page
> twice on two different pages, using a different offset
> for PdfContentByte.addTemplate().
>
>> If not I am willing to lose search facilty
>
> You will not use the search facility, but you will
> loose all other interactive features: links, bookmarks,
> annotations,...
> br,
> Bruno
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share
> your
> opinions on IT & business topics through brief surveys - and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> iText-questions mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/itext-questions
> Buy the iText book: http://itext.ugent.be/itext-in-action/
>
>
--
View this message in context:
http://www.nabble.com/Vertical-Split-tf2712572.html#a9139434
Sent from the iText - General mailing list archive at Nabble.com.
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://itext.ugent.be/itext-in-action/