60000124 PDF Export

Article 60000124
Type HowTo
Product Engine
Version 6
Date Added 4/20/2007 12:00:00 AM
Fixed (4/20/2007 12:00:00 AM)
Submitted by Peter Chanios


In version 6006 PDF export has been added.


In Version 6006 PDF 1.4 export was added as functionality to the vdDocument's SaveAs Method.

In order to use this functionality you can either use the SaveAs function with ".pdf" extension to the filename or ExportToFile function with the same extension.

By Default the ActiveLayout is saved using the extends of the drawing and in Landscape or Portrait depending which orientation is fitting better the drawing.Also the TTF Texts are rendered as Filled Shapes and SHX as simple lines and cannot be edited or selected.

The Above default behaviour can be changed with a newly added property named PDFExportPropertiesFlags to the FileProperties property of VectorDraw.Proffesional.vdObjects.vdDocument object. This property has the following values:

-DrawOutlineText:This is the default value and is described above.
-UsePrinterPropertiesWith_OutlineText: This value will create the texts as described above but will use the ActiveLayout's printer properties to select the PrintingWindow,PrintingScale,PaperSize,Margins, Orientation for output.
-DrawTextAsSelected: Using this value the extends of the ActiveLayout will be saved and the texts will be added as PDF text and can be editable and selected.This value should be used only if the drawing contains texts that use characters up to 127(english/latin characters). If the drawing contains any other characters (chinese) this value shouldn't be used. PDF size will be smaller if such texts exist.
-UsePrinterWithTextAsSelected:Using this value the texts will be saved as described above but the printer's properties will be used for the output. PDF size will be bigger if a lot of texts exist in the drawing.
-DoublePrecision of FileProperties : Using a value like 2 or 3 (default is 8) leeds to smaller PDF size.

When using the Printer's properties you should first be sure that a printer is selected and all properties of the printer are as desired because in other case the output will not be as expected.
In addition You can use the TextStyle's DrawOutLine property for texts that are over 127. For example you can use the DrawTextAsSelected property for texts that are over 127 character(chinese) use a textstyle with DrawOutLine property True. This way the latin characters will be saved as text and will be edited and selected at the PDF and other characters will be saved as solid polygons.

You can Test the PDF
output in VectorCad by opening a drawing and choose SaveAs.Before saving the drawing change the value of the PDFExportPropertiesFlags property located at the Document's Fileproperties property. You can also change the printer's properties(Select portion of the drawing (Pick window) using the Printdialog and also change the Margins and orientation and then use the SaveAs function and select PDF.

For user's that use .NET components like vdFramedControl you can simply modify the above properties as described below:
vdFramedControl1.BaseControl.ActiveDocument.FileProperties.PDFExportProperties = VectorDraw.Professional.vdObjects.vdFileProperties.PDFExportPropertiesFlags.DrawTextAsSelected;

For user's that work with the wrapper component is a bit more complicated to use the above property.Please check the code below written in vb6:

You should add a reference to the project at the VectorDraw.Proffesional.tlb in order to get the VectorDraw_Professional.vdDocument wrapper object.

Dim doc As VectorDraw_Professional.vdDocument

Set doc = VDraw1.ActiveDocument.WrapperObject
doc.FileProperties.PDFExportProperties = PDFExportPropertiesFlags_DrawOutlineText
VDraw1.ActiveDocument.SaveAs "c:\\temp\\.saved.pdf", DefaultVersion

Send comments on this topic.