Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iText(sharp) - Read PDF file an draw it _resized_ on another

691 views
Skip to first unread message

SH

unread,
Nov 27, 2008, 3:46:48 PM11/27/08
to
As already mentioned in the title:

I'm trying to read an existing pdf, resize it and then draw it on a new one.

Does somebody know how to do this? (API-Commands, c# prefered)

Reading and drawing works, I'm just looking for a simple way to make the
read pdf smaller,
so that it fits on a new page with additional text on top of that page.


Thank you for your help.


MfG
S.H.


Govert J. Knopper

unread,
Nov 28, 2008, 4:57:52 AM11/28/08
to

SH

unread,
Nov 28, 2008, 9:14:41 AM11/28/08
to
> Explained here very well:
> http://itextsharp.sourceforge.net/tutorial/ch10.html
>
> Govert


I'm sorry, but that is not really what I was looking for.
Or I'm to stupid to unterstand your intention.

I'd like to read an existing pdf page, resize it, and draw it on a new page.
The page you linked, describes positioning of new text and graphics.

MfG
S.H.


Govert J. Knopper

unread,
Nov 29, 2008, 1:54:45 AM11/29/08
to
> > Explained here very well:
> > http://itextsharp.sourceforge.net/tutorial/ch10.html
> >

> I'm sorry, but that is not really what I was looking for.


> Or I'm to stupid to unterstand your intention.
>
> I'd like to read an existing pdf page, resize it, and draw it on a new
page.
> The page you linked, describes positioning of new text and graphics.

Simple example (scales 1st page of In.PDF on an A4 page (lowerleft corner)
of Out.PDF):
....
PdfReader reader = new PdfReader("In.PDF");
Document doc = new Document(PageSize.A4, 0, 0, 0, 0);
PdfWriter writer = PdfWriter.GetInstance(doc, new FileStream("Out.PDF",
FileMode.Create));
doc.Open();
PdfContentByte cb = writer.DirectContent;
PdfImportedPage page = writer.GetImportedPage(reader, 1); //page #1
float Scale = 0.67f;
cb.AddTemplate(page, Scale, 0, 0, Scale, 0, 0);
doc.Close();
....

Govert

http://www.noliturbare.com


SH

unread,
Nov 29, 2008, 9:34:07 AM11/29/08
to
You helped me very much with this snippet. Thanks alot.

MfG
S.H.


0 new messages