60000329 Multi Page Print on PDF.

Article 60000329
Type Wish
Product Engine
Version 6010
Date Added 11/23/2007 12:00:00 AM
Fixed (12/11/2007 12:00:00 AM)
Submitted by Hill, Steven

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");



In version 7.7014 we added in vdDocument object a method named ExportMultiPagePDF that can be used VDF Wrapper ActiveX in order to export PDF files with more than one pages. See article 70001256.


Send comments on this topic.