Kkula
Browse Questions » Plant Engineering Software COMOS: copy Pdf From a revision

About User

Questions Asked: 24.4K

Answers Given: 0

0
  • Open

Plant Engineering Software COMOS: copy Pdf From a revision

We want to copy a PDF file of a certain revision to a drive, but our programming skills are too weak for this...
How do you get a specific PDF file for a revised document?
Example: a document has 5 revisions and I want to copy the 3rd revision as a PDF to a path.
Can someone list me the complete methods and functions of the "ComosRevisionMaster.RevisionMaster" function?
We already have this in use, but only with deleting the last revision (Document.Revisions.Item(Document.Revisions.count)).DeleteAll, but I don't know how to select a revision in between so that it then falls on the drive can be copied.
Siemens has already programmed this function in a dll, but unfortunately we no longer have the source code.

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Retrieving a Specific PDF Revision in COMOS

You want to extract a specific revision of a PDF document within COMOS, and you're facing challenges due to limited programming expertise and lost source code. Here's a breakdown of approaches, considering you're already using ComosRevisionMaster.RevisionMaster:

Methods to Retrieve a Specific Revision

  1. Using Indexing: The Document.Revisions collection is likely index-based (starting at 1). You should be able to access the desired revision directly using its index number. For example, to access the 3rd revision: Document.Revisions.Item(3).
  2. Iterating and Checking Revision Numbers: If revisions aren't consistently numbered, iterate through the Document.Revisions collection and check each revision's number or date against your target revision.
  3. COMOS API Documentation: Refer to the official COMOS API documentation (available through SiePortal – see link below) for precise details on the ComosRevisionMaster.RevisionMaster function and the Document.Revisions collection.

Copying the PDF

Once you've accessed the desired revision (e.g., myRevision), you'll need to extract the PDF data and save it to your desired path. This typically involves:

  1. Accessing the PDF data from the revision object (the exact property name will be in the COMOS API documentation).
  2. Using standard .NET file I/O methods (e.g., System.IO.File.WriteAllBytes) to write the PDF data to a file on the drive.

ComosRevisionMaster.RevisionMaster Function Details

Unfortunately, without the original source code or complete API documentation, a comprehensive list of all methods and functions within ComosRevisionMaster.RevisionMaster is difficult. However, SiePortal is your best resource:

SiePortal – Search for "COMOS API Documentation" or "ComosRevisionMaster" to access the official documentation which should detail available functions and properties.

Important Considerations:

  • Error Handling: Implement robust error handling to catch potential exceptions (e.g., invalid revision index).
  • Permissions: Ensure the user account running the process has appropriate permissions to access both COMOS data and the target drive.
0
Add a comment