Split dxf into multiple pdf Pages

I have a big Dxf File which I want to convert into a Pdf file. It looks fine, but the Page-Size is very too large. Can the result splitted into multiple pages of a fixed Size (A4 or A3)?
I am using C# for the converter.

@WalterN,
Hello.
Please, clarify, are we talking about export of the part of Model sheet into different PDF? Into single multipage PDF? Multiple sheets into single/multiple PDF? Could you please attach the file for review?

Schicht-Profil_Verziehung.pdf (1,2 MB)

Schicht-Profil_Verziehung.7z (16,8 KB)

Hi, I have added two attachments, one is a big dxf-File (in the 7z-file) and another pdf how it should looks like. I need to convert one dfx File into one pdf file with a fixed pagesize. If the Drawing is bigger it should be splitted into multiple pages in the same file. It would be nice if we can add a zoom factor - if this is not possible we can adjust the dxf file to adopt the scale.

@WalterN,
you can export the entire drawing into some size, e.g.:

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
{
CadRasterizationOptions cadRasterizationOptions = new CadRasterizationOptions();
cadRasterizationOptions.PageWidth = 8.27f;
cadRasterizationOptions.PageHeight = 11.69f;
cadRasterizationOptions.UnitType = UnitType.Inch;
cadRasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;

PdfOptions pdfOptions = new PdfOptions();
pdfOptions.VectorRasterizationOptions = cadRasterizationOptions;

cadImage.Save("output.pdf", pdfOptions);
}

or it is possible to export part of the drawing (I’m afraid we can not render multiple parts in the same PDF, but separate PDf files could be merged into single with Aspose.PDF for instance):

using (CadImage cadImage = (CadImage)Aspose.CAD.Image.Load(fileName))
{         
	PdfOptions options = new PdfOptions();
	CadRasterizationOptions rasterizationOptions = new CadRasterizationOptions();
	options.VectorRasterizationOptions = rasterizationOptions;
	rasterizationOptions.DrawType = CadDrawTypeMode.UseObjectColor;
	rasterizationOptions.NoScaling = true;
 
	rasterizationOptions.PageWidth = 8.27f;
	rasterizationOptions.PageHeight = 11.69f;
	rasterizationOptions.UnitType = UnitType.Inch;

	// for the top part of the drawing
	//Point topLeft = new Point((int)(cadImage.MinPoint.X), (int)(cadImage.MaxPoint.Y));

	// for the bottom part of the drawing
	Point topLeft = new Point((int)(cadImage.MinPoint.X), (int)(cadImage.MaxPoint.Y - cadImage.Height / 2));

	double width = cadImage.Width;
	double height = cadImage.Height / 2;

	SetViewport(cadImage, topLeft, width, height);
	cadImage.Save("result.pdf", options);
}
		
private static void SetViewport(CadImage cadImage, Point topLeft, double width, double height)
{
	CadVportTableObject newView = new CadVportTableObject();

	// note: exactly such table name is required for active view
	newView.Name = "*Active";
	newView.CenterPoint.X = topLeft.X + width / 2f;
	newView.CenterPoint.Y = topLeft.Y - height / 2f;
	newView.ViewHeight = height;
	newView.ViewAspectRatio = width / height;

	// search for active viewport and replace it
	for (int i = 0; i < cadImage.ViewPorts.Count; i++)
	{
		CadVportTableObject currentView = (CadVportTableObject)(cadImage.ViewPorts[i]);
		if ((currentView.Name == null && cadImage.ViewPorts.Count == 1) ||
			string.Equals(currentView.Name.ToLowerInvariant(), "*active"))
		{
			cadImage.ViewPorts[i] = newView;
			break;
		}
	}
}

Thank you verry much for the support: it is working :slight_smile:

@WalterN,
we were happy to help :slight_smile: