DWG with xref's to PDF

Can anyone help me with converting DWG with attached XREF’s and with layout (drawing table, drawing name, number etc.) to PDF file. When I am using standard example code and pointing main DWG file and then converting it to PDF, there is no XREF’s objects in, there is only main file objects. Sample code from this post: Python SDK for CAD and BIM Files Processing | Aspose.CAD Product Family

@mateuszo

To convert a DWG file with attached XREFs (external references) to a PDF while ensuring that all objects, including those from XREFs, are included, you can follow these steps using Aspose.CAD:

  1. Load the DWG File: Use the Image.Load method to load your main DWG file.

  2. Set Rasterization Options: Create an instance of CadRasterizationOptions and configure its properties such as PageWidth, PageHeight, and Layouts. This will help in defining how the drawing is rendered.

  3. Configure PDF Options: Create an instance of PdfOptions and set the VectorRasterizationOptions property to the rasterization options you created earlier.

  4. Save as PDF: Finally, call the Save method on the loaded image, passing the output file path and the PDF options.

Here is a sample code snippet demonstrating these steps:

using Aspose.CAD;
using Aspose.CAD.ImageOptions;

namespace Aspose.CAD.Examples
{
    public class ExportDWGToPDF
    {
        public static void Run()
        {
            // Load the DWG file
            string sourceFilePath = "path/to/your/file.dwg";
            using (CadImage cadImage = (CadImage)Image.Load(sourceFilePath))
            {
                // Set up rasterization options
                CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions
                {
                    PageWidth = 1600,
                    PageHeight = 1600,
                    Layouts = new string[] { "Model" } // Specify the layout to export
                };

                // Set up PDF options
                PdfOptions pdfOptions = new PdfOptions
                {
                    VectorRasterizationOptions = rasterizationOptions
                };

                // Save the DWG as a PDF
                string outputFilePath = "path/to/your/output.pdf";
                cadImage.Save(outputFilePath, pdfOptions);
            }
        }
    }
}

Make sure that the layout you specify in the Layouts property includes the XREFs you want to render. If the XREFs are not appearing, ensure that they are correctly referenced in the main DWG file and that the paths to the XREF files are accessible.

For more detailed information on exporting DWG files to PDF, you can refer to the official documentation on Aspose.CAD for .NET here.

But there is problem when i have XREF with map inserted in MODEL layout and then in paperspace of for example layout named 01 when only part of the map is visible. Then there is no XREF with map on generated PDF.

@mateuszo,
Hello,
please attach the sample DWG file so we can reproduce this issue on our side.