Document 20 entries
documents and file handling
Entries in this section
- doc.PagesThe page collection. doc.Pages.Count for the total, doc.Pages.Item(i) for the i-th page (1
- doc.AddPages(n)Appends n pages at the end. The idiom while len(doc.Pages) < page_index: doc.AddPages(1) m
- doc.ActivePageThe current page object.
- doc.ActiveLayerThe active layer of the current page.
- doc.UnitDocument unit (cdrUnit). Every geometric value follows it: shape coordinates and sizes, pa
- doc.ResolutionDocument resolution in dpi. Affects bitmap export and effect rendering.
- doc.ReferencePointReference point for transforms. It anchors SetPosition and SetSize and follows the cdrRefe
- doc.ClearSelection()Deselects everything. Call it before a batch run so you don't accidentally modify whatever
- doc.BeginCommandGroup(commandName)Opens an undo group; everything after it collapses into one entry in the undo list. Mandat
- doc.EndCommandGroup()Closes the undo group. It must pair with Begin, including in a finally block — if an excep
- doc.Undo() / doc.Redo()Undo or redo one step.
- doc.Save() / doc.SaveAs(path)Save, or save under a new path. Don't save inside a per-page loop; once at the end is enou
- doc.ExportEx(path, filter, options)General-purpose export. filter takes a cdrFilter value (PDF, JPG, PNG and SVG each have on
- doc.PublishToPDF(path)Exports a PDF. The simplest export call there is; the defaults are fine.
- doc.ExportBitmap(...)Bitmap export. The signature is long (width, height, dpi, antialiasing, transparency, colo
- doc.PrintOut()Prints. Takes a PrintOptions object; you won't need it day to day.
- doc.Close()Closes the document. With unsaved changes it may raise a dialog and stall the script, so d
- doc.FileName / doc.DirtyFileName is the file path; Dirty is whether there are unsaved changes (True/False).
- doc.Grid / doc.SnapToGrid / doc.SnapToShapes / doc.SnapToGuidelinesThe grid and the various snapping switches. Turn them all off for automated layout, or Set
- doc.GuidesThe guide collection. Readable and writable.
Getting StartedConnection & InitApplicationDocumentPageLayer & ShapesGeometry & TransformGroup / Order / BooleanShape AppearanceTextTextRangeFillOutlinePowerClipFountain FillPattern / Texture FillTransparency & BlendEffectsColorCurve & NodeBitmapFind & TraverseUnits & ConversionImport / ExportEnumerationsObject DataAlign / DistributeLayer AdvancedView & PerformanceEventsRecipesPitfalls