Delete a Page of Docx & Txt file formats

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
trupti
Posts: 4
Joined: Tue Apr 25, 2017 9:04 pm

Delete a Page of Docx & Txt file formats

Post by trupti » Thu Jun 01, 2017 4:18 pm

Hello,

I am working on ASP.NET Web Forms 4.5 using GDPictures 14 & DocuVieware component.
In my app I have added feature to Remove/Delete current Page. The Delete Curr Page is working fine with PDF & Image files (with more than 1 page) & Scanned docs page.

For docx & txt, for

Code: Select all

GetNativeImage()
, I don't get any imageId. Is it possible to delete a page from these & other file formats that I have not mentioned/handled. If so, how can I do that. I couldn't find any other way to retrieve the doc & call a method to delete a page.
In my javascript code :

Code: Select all

var params = { currentPage: currentPage };
            DocuViewareAPI.PostCustomServerAction("docuView", true, "RemovePage", params);
In my code behind :

Code: Select all

      public static void HandleRemovePage(CustomActionEventArgs e)
        {
            RotateActionParameters rotateParams = JsonConvert.DeserializeObject<RotateActionParameters>(e.args.ToString());
            int currPage = rotateParams.CurrentPage;

            rotateParams = null;

            // For PDF FILES
            if (e.docuVieware.GetDocumentType() == DocumentType.DocumentTypePDF)
            {
                GdPicturePDF gdPdf = null;
                if (e.docuVieware.GetNativePDF(out gdPdf) == GdPictureStatus.OK)
                {
                    gdPdf.DeletePage(currPage);
                    e.message = GetMessage ("Page Deleted Successfully ", DocuViewareMessageIcon.Information); 
                }
            }

            // For Image Files, Scanned docs
            int imgId;
            if (e.docuVieware.GetNativeImage(out imgId) == GdPictureStatus.OK)   // Doesn't get imgId for docx, txt files
            {
                GdPictureImaging gdImg = new GdPictureImaging();
                if (gdImg.SelectPage(imgId, currPage) == GdPictureStatus.OK)
                {
                    if ( gdImg.TiffDeletePage(imgId, currPage) == GdPictureStatus.OK)
                        //gdImg.ReleaseGdPictureImage(imgId) == GdPictureStatus.OK)
                    {
                        e.message = GetMessage("Document was rejected successfully.", DocuViewareMessageIcon.Information);
                    }
                }
            }

            return;
        }

Can you please help me with this !
Also, on calling CloseDocument() & Deleting a page, is it advisable to call gdImg.ReleaseGdPictureImage(imgId) ???

Thanks

Trupti

Gabriela
Posts: 378
Joined: Wed Nov 22, 2017 9:52 am

Re: Delete a Page of Docx & Txt file formats

Post by Gabriela » Sun Jan 27, 2019 2:17 pm

Hello,

You can not handle DOCX and TXT file formats through GdPictureImaging class, because they are not images. GdPicture toolkit does not provide editable features for DOCX, such as delete page. For TXT files, the delete page does not have any sense.
Kind regards,

Gabriela
GdPicture Team

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest