Can we read dwg file through inputstream and add the markup from other contentfile stream

hi, we have dwg and markupcontent in two different, can we have anymethod which can take inputstream of these two and add as layer like iText like PDFStamper.addComments and save as single file?

@snazeer

Currently, Aspose.CAD does not provide a direct method to read a DWG file from an input stream and overlay markup from another content file stream in a manner similar to how iText’s PDFStamper.addComments works. However, you can achieve similar functionality by following these steps:

  1. Load the DWG File: Use the Aspose.CAD API to load the DWG file from an input stream.
  2. Convert to PDF: Convert the loaded DWG file to a PDF format, as Aspose.CAD supports exporting DWG drawings to PDF.
  3. Overlay Markup: After converting the DWG to PDF, you can use Aspose.PDF to add markup or comments to the PDF file. This can be done by loading the PDF from a stream and then adding the necessary annotations or comments.

Here is a basic code example to illustrate this process:

using Aspose.CAD;
using Aspose.CAD.ImageOptions;
using Aspose.Pdf;
using Aspose.Pdf.Annotations;
using System.IO;

// Load DWG from input stream
using (FileStream dwgStream = new FileStream("path/to/your.dwg", FileMode.Open))
{
    using (var image = Image.Load(dwgStream))
    {
        // Convert DWG to PDF
        var pdfOptions = new PdfOptions();
        image.Save("output.pdf", pdfOptions);
    }
}

// Load the generated PDF and add markup
using (FileStream pdfStream = new FileStream("output.pdf", FileMode.Open))
{
    Document pdfDocument = new Document(pdfStream);
    
    // Add a comment or markup
    var textAnnotation = new TextAnnotation(pdfDocument.Pages[1], new Rectangle(100, 100, 200, 200))
    {
        Contents = "Your markup content here",
        Title = "Markup Title",
        Subject = "Markup Subject"
    };
    pdfDocument.Pages[1].Annotations.Add(textAnnotation);
    
    // Save the modified PDF
    pdfDocument.Save("final_output.pdf");
}

This example demonstrates how to load a DWG file, convert it to PDF, and then add annotations to the PDF. You can adjust the markup content and positioning as needed.

For more detailed information on working with DWG files and converting them to PDF, you can refer to the Aspose.CAD documentation.

If you have any further questions or need additional assistance, feel free to ask!

@snazeer,
please clarify the task and provide some initial files so we can think about the solution. What is markup content? What is the output format? What is the desried result of such merge?