How can I use Annotation Manager with dxf files?

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
garfield
Posts: 6
Joined: Mon Nov 07, 2016 7:42 am

How can I use Annotation Manager with dxf files?

Post by garfield » Fri Aug 10, 2018 8:08 am

Hi

I am using an old version of docuvieware and about to upgrade to lastest version for dxf file support in the project.
But unfortunately I can't find the way to contorl the annotations in dxf file.

In my case, I need to use AnnotationManager to get full control of the annotations. The manager initials like:
dvwDocument.GetNativePDF(out gdPicturePDF);
manager.InitFromGdPicturePDF(gdPicturePDF);
or
dvwDocument.GetNativeImage(out imageID);
manager.InitFromGdPictureImage(imageID);

But in dxf files, these two ways can't initialize the manager, and returns "UnsupportedImageFormat" status.
Also tried the InitFromStream function but it results the same.

So if there's something I missed ?
How can I use annotation manager in dxf files?

Thanks.

User avatar
Loïc
Site Admin
Posts: 5586
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How can I use Annotation Manager with dxf files?

Post by Loïc » Mon Aug 13, 2018 5:06 pm

Hi,

You have at least 2 options:

1:
Use the GetAnnotationManager() method of the DocuVieware class.

2:
Use this approach (tested with latest version).

Code: Select all

            FileStream fileStream = File.OpenRead("d:\\test.dxf");
            AnnotationManager annotationManager = new AnnotationManager();
            GdPictureStatus status = annotationManager.InitFromStream(fileStream);
Please let me know if you need further information.

With best regards,

Loïc

garfield
Posts: 6
Joined: Mon Nov 07, 2016 7:42 am

Re: How can I use Annotation Manager with dxf files?

Post by garfield » Wed Aug 15, 2018 8:36 am

Hi Loïc

I still have some questions.

1: I have checked the DocuVieware class in document but can't find the "GetAnnotationManager" method. If your api have this method, it could be very helpful.

2: I found that if I just call the "InitFromStream" method, it works fine. But please check the attached pics.
First I load the document, then initFromStream failed.
So I change another way, initFromStream first, but load document failed...

Thanks.
Attachments
TIM截图20180815143034.png
TIM截图20180815142855.png

User avatar
Loïc
Site Admin
Posts: 5586
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: How can I use Annotation Manager with dxf files?

Post by Loïc » Wed Aug 15, 2018 1:19 pm

Hi Garfield,

For 1:

My apologies, I made the confusion with an internal method of the toolkit. Y can deal with these two method to import / export annotations:

public GdPictureStatus SaveAnnotations(Stream Annotations, bool AllPages)
public GdPictureStatus LoadAnnotations(Stream Annotations)

For 2:

You are calling the LoadFromStream by setting true to the ownStream parameter. Subsequently to this call, the stream is disposed. So you can not access it anymore.

Kind regards,

Loïc

garfield
Posts: 6
Joined: Mon Nov 07, 2016 7:42 am

Re: How can I use Annotation Manager with dxf files?

Post by garfield » Thu Aug 16, 2018 11:43 am

Hi Loïc

Unfortunately I can't use SaveAnnotations and LoadAnnotations method because we use xml format data and save in database instead of file itself.
Actually I use AnnotationManager.AddAnnotationFromXML and AnnotationManager.GetAnnotationXML method to save and load annotations.

And since you had :
Docuvieware.GetNativePDF, AnnotationManager.InitFromGdPicturePDF
and Docuvieware.GetNativeImage, AnnotationManager.InitFromGdPictureImage
method, I wonder if there methods like "GetNativeDXF", "InitFromGdPictureDXF" or something ?

About the LoadFromStream method, I also tried to set the 'ownStream' to false, it works for pdf and images, but failed in dxf files. Please check the files attached.


Thanks.
Attachments
TIM截图20180816172011.png
TIM截图20180816172011.png (11.69 KiB) Viewed 16 times
TIM截图20180816171947.png
TIM截图20180816171947.png (10.96 KiB) Viewed 16 times

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest