[PDFNet] Qusetions about PDF creator 'pdftron.PDF.Convert.ToPDF'

Q: I need to find a PDF creator (for .NET/C#) which can provide
different page settings and image placement capabilities. After a
quick check of your product (Convert sample -
http://www.pdftron.com/pdfnet/samplecode.html#Convert) , here are the
things I can't figure out whether are supported and how to implement
them if they are:

1. Each page dimension settings (varies from one to another).
2. Each page background settings (varies from one to another).
3. Each page margin settings (varies from one to another).
4. Document DPI settings.
--------------------------
A: Because PDFNet implements a number of direct format converters
(besides fallback conversion via a virtual printer driver) these
options are not set prior to conversion to PDF, however they can be
implemented after document is imported.

For example after calling ‘pdftron.PDF.Convert.ToPDF’ you can scale
the page, adjust the margins, and modify page boxes before saving the
PDF. As a starting point you may want to take a look at 'Rect' sample
project http://www.pdftron.com/pdfnet/samplecode.html#Rect.

To modify page background you can use ElementBuilder & Element Writer
(see ‘How do I add a watermark to a page?’ in PDFNet FAQ -
http://www.pdftron.com/pdfnet/faq.html). In this case you would create
a single rectangle, the size of the page and write it in a background
layer. For example (in C#):

ElementBuilder b = new ElementBuilder();
ElementWriter w = new ElementWriter();

w.Begin(page, ElementWriter.WriteMode.e_underlay);

Rect box = page.GetMediaBox();
Element el = b.CreateRect (box.x1, box.y1, box.Width(), box.Height());
el.SetPathStroke(false);
el.SetPathFill(true);
el.SetPathFill(true);
el.GetGState().SetFillColorSpace(ColorSpace.CreateDeviceRGB());
el.GetGState().SetFillColor(new ColorPt(1, 0, 0)); // red
w.WriteElement(element);
writer.End();

b.Dispose();
w.Dispose();

You can use this approach to add any type of background (including a
image, a pattern, another PDF page, etc). It is simply more powerful
and flexible.

By default, the convert API converts using full quality, however the
resulting document can be optimized using other API (e.g. along the
lines of JBIG2 sample). We are also planning to include additional,
easy to use PDF optimization options in pdfdoc.Save() to further
simplify the task.

--
You received this message because you are subscribed to the "PDFTron PDFNet SDK" group. To post to this group, send email to support@pdftron.com
To unsubscribe from this group, send email to pdfnet-sdk-unsubscribe@googlegroups.com. For more information, please visit us at http://www.pdftron.com