Q; Using ElementBuilder as a guide, having got the general idea to
make sure I could have one common application that could make PDF's or
print directly.
The images are giving me fits. the whole PDF matrix is beyond what I
want to learn. If you could spare me the time to have to learn
2DMatrix, I would appreciate it.
Question 1:
In Windows, the simplified code would be this:
Bitmap bitmap = new Bitmap("peppers.jpg");
e.Graphics.DrawImage(bitmap, 60, 10);
or
e.Graphics.DrawImage(bitmap, 60, 10, width, height);/// stretches
bitmap
to another size
In PDFTron, the simplified code to format a Windows image of the same
size
into a PDF would be this
System.Drawing.Bitmap bmp = new System.Drawing.Bitmap("peppers.jpg" );
pdftron.PDF.Image img = pdftron.PDF.Image.Create(Document, bmp);
Element element = theElementBuilder.CreateImage(img, new
Matrix2D(…???
theElementWriter.WritePlacedElement(element);
or
expand the bitmap to larger/smaller width-height starting at the same
x,y
coordinates...............??
Question 2:
On the Windows graphic side, I just lifted the code from PDFPrint and
put it
in my C# code to include a PDF into the printed documents. Works like
a champ. Both in ancient 1995 C program and the new C# version.
On the PDF side I need to do the same thing. If you could point me to
how to
read one or more pages from an existing PDF and include it in a
ElementBuilderTest, I would be very
happy.
------
A: Re: Q1) You may want to use:
Element element = theElementBuilder.CreateImage(img, new Matrix2D
(width, 0, 0, height, 60, 10));
where 60, 10 is the horizontal/vertical offset (similar to GDI+ code).
Re Q2:
If you simply want to copy some pages from one document to another you
could use pdfdoc.PagePushBack(page)/PagePushFrom(page)/PageInsert(idx,
page) as illustrated in PDFPage sample project (also you may want to
read through http://www.pdftron.com/net/usermanual.html#page_manip)
If you need to add content to an existing PDF document, you could
simply open the PDF file, get the required page and start adding the
content (for a concrete example, please take a look at
http://www.pdftron.com/net/faq.html#how_watermark).