Prod.: Engine, ver.: 6010, ID: 60000329, Wish : Multi Page Print on PDF.

Wish : Multi Page Print on PDF.

Article60000329
TypeWish
ProductEngine
Version6010
Date Added11/23/2007
FixedYes [12/11/2007]
Submitted byHill, Steven
Keywords

Subject

Multi Page Print on PDF.

Summary

Multi Page Print on PDF.

Solution


In version 6011 we added in PrinterRender object a method named ExportMultiPagePDF that can be used in order to export PDF files with more than one pages.


A sample code is provided that exports all layouts of a drawing in separate pages of a PDF file (extends and printToScale).


int numprinters = vdFramedControl.BaseControl.ActiveDocument.LayOuts.Count + 1;
vdPrint []printers = new vdPrint[numprinters];
int i = 0;
printers[i] = vdFramedControl.BaseControl.ActiveDocument.Model.Printer;
printers[i].PrintExtents();
printers[i].PrintScaleToFit();
i++;
foreach (vdLayout layout in vdFramedControl.BaseControl.ActiveDocument.LayOuts)
{
printers[i] = layout.Printer;
i++;
}
VectorDraw.Render.PrinterRender.ExportMultiPagePDF(new RenderFormats.PdfRender(), vdFramedControl.BaseControl.ActiveDocument, printers, @"C:\Documents and Settings\Administrator\Desktop\test.pdf");


If your drawing doesn't have layouts (just the Model) and you want to print 2 or more regions of the Model in a multipage PDF document then you can use a code like :

int numprinters = 2; //two pages = two regions
VectorDraw.Professional.vdObjects.
vdPrint[] printers = new VectorDraw.Professional.vdObjects.vdPrint[numprinters];
int i = 0;

//set the first printer settings and printable area
printers[i] = new VectorDraw.Professional.vdObjects.vdPrint(vdFramedC.BaseControl.ActiveDocument.Model.Printer);
printers[i].PrintWindow =
new VectorDraw.Geometry.Box(new VectorDraw.Geometry.gPoint(-2, -1), new VectorDraw.Geometry.gPoint(866, 1122));
printers[i].PrintScaleToFit();

//set the second printer settings and printable area
i++;
printers[i] =
new VectorDraw.Professional.vdObjects.vdPrint(vdFramedC.BaseControl.ActiveDocument.Model.Printer);
printers[i].PrintWindow =
new VectorDraw.Geometry.Box(new VectorDraw.Geometry.gPoint(-2, -1458), new VectorDraw.Geometry.gPoint(866, -330));
printers[i].PrintScaleToFit();

//Export to PDF
VectorDraw.Render.PrinterRender.ExportMultiPagePDF(new RenderFormats.PdfRender(), vdFramedC.BaseControl.ActiveDocument, printers, @"C:\testing\test1.pdf");