We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Get page size/dimenstions from DWF

Hi,

I’m trying to get the size of the page in a DWF file.
I have used the example from this website, here is the code I’m using
using (DwfImage image = (DwfImage)Aspose.CAD.Image.Load("{path}"))
{
int i = 1;
foreach (var page in image.Pages)
{
CadRasterizationOptions options = new CadRasterizationOptions();

                                    double sizeExtX = page.MaxPoint.X - page.MinPoint.X;
                                    double sizeExtY = page.MaxPoint.Y - page.MinPoint.Y;
                                    
                                        options.PageHeight = (float)sizeExtY;
                                        options.PageWidth = (float)sizeExtX;
                                }
                            }

What i get for page number 1 for example is: 2175X909
when we load the file to a plotter printer it shows as 2200X900

if i debug the code I can see these dimensions like in the plotter in some of the properties but can’t seem to get to them

what can be done to retrieve the page size and not the elements total width/height on the page

thanks

@yoniDekel,
Hello, could you please attach the file so we can investigate it?

The file I’m talking about belong to a client. I cannot share the file.

do you have a sample file for me to try an see what metadata I get for that file?

@yoniDekel,
got it, unfortunately, we don’t have sample file to share too. OK, give us some time to investigate this issue on our side.

What do you think would be a time frame for an answer

thanks,

@yoniDekel,
this issue (CADNET-8495) is planned to be solved in 22.2 release, which is expected in February.

oh, you found/know about the bug?

@yoniDekel,
yes, we will add the information not only about calculated sizes of the page but about sizes stored in file too.

Sounds good. is there any workaround for now so I can show my client what is my solution?

Will it be part of the free nuget? I’m using 21.12 for now, and before buying the license I want to see that it works like we expect it to work

Thanks

@yoniDekel,
unfortunately, there is no workaroind for now. Yes, it will be available in updated nuget package, we hope it will fit your requirements.

Hi Alex,

Any update regarding the fix for DWF files in ASOPSE CAD?

thanks

image001.png (421 Bytes)

asset20_ce831691-7af1-4a28-8578-d1a350867362.png (2.46 KB)

@yoniDekel,
Hello, we expect to have next Aspose.CAD for .NET 22.2 release at the end of the week.

Hi,

I see only 22.1.0 on Nuget

any updates?

@yoniDekel,
we are still in preparation process, you will get notification when release is available.

Hi,

Any updates?

image001.png (421 Bytes)

asset20_ce831691-7af1-4a28-8578-d1a350867362.png (2.46 KB)

@yoniDekel,
we are almost done woth release, I will notify you when it is available.

The issues you have found earlier (filed as CADNET-8495) have been fixed in this Aspose.CAD for .NET 22.2 update. This message was posted using Bugs notification tool by Oleksii.Gorokhovatskyi

The MSI file has 22.1 installation, is that right?

@yoniDekel,
yes, unfortunately, the public release number has previous label.
Please, test if this snippet is useful for you in this release:

using (DwfImage image = (DwfImage)Image.Load(fileName))
            {
                UnitType resultUnits = image.Pages[0].UnitType;
                double resultWidth = image.Pages[0].PaperWidth;
                double resultHeight = image.Pages[0].PaperHeight;
            }

I have installed the MSI file, got the folder for .net4 and extract the DLL file
I have added it to my project and got error: Could not load file or assembly ‘file:///X:\Aspose.CAD.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)

please advice how do I add this dll to my project