Loading...

Multi-pages : how to keep the changes (draw, ...) ?

Support for GdPicture Light Imaging Toolkit and GdPicture Pro Imaging ActiveX/SDK.

Multi-pages : how to keep the changes (draw, ...) ?

Postby louis » Thu Mar 25, 2010 4:47 pm

Hi Loic,

I have a little doubt ... ! Or I'm half asleep ...

When we make some modifications in a page (draw text, lines, ...), then we change the page, and we go back to the previous page, the modifications seem to be lost.
How to do to keep them ? Is it necessary to save the image handle before changing the page ?
To do that, is there an event to be used before PageChange ? Or must we save the image handle each time we make a modification in order to prevent the change of page ?

Louis
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby Loïc » Thu Mar 25, 2010 6:11 pm

Hi Louis,

Which kind of document are you edition and which method are you using ?

Kind regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby louis » Thu Mar 25, 2010 6:20 pm

I'm using a pdf document with 6 pages and I change some rectangular zones on the 1st page with SetROI and SwapColor (white to yellow). I go to the 2nd page then to the 1st. The rectangular zones are white like when I open the document.
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby louis » Thu Mar 25, 2010 7:39 pm

More information may be useful :
I use this code to initialize the viewer (GDV_File) and the imaging (GDI_File) after the display of the file with GDV_File.DisplayFromPdfFile :

GDI_File.SetNativeImage (GDV_File.GetNativeImage)
GDV_File.SetNativeImage (GDI_File.GetNativeImage)

After GDI_File.SwapColor, I use GDV_File.Redraw
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby Loïc » Fri Mar 26, 2010 2:50 pm

Hi,

You can edit a PDF document like with this method.

What you have to do is:

- Extract all PDF page to bitmap
- Edit desired bitmap
- Compose a new document from extracted bitmaps.

You can find a lot of sample into the code request section. Please have a look on it.

With best regards,

Loïc Carrère
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby louis » Fri Mar 26, 2010 3:21 pm

Hi Loic,

Ok, your suggestion may be convenient, ... but what do you think about mine ? That is to say, save the image, reload it when there is a page change.
Because I need to edit one page, move to another page, edit it, back to the previous, edit it, ... Is it possible with your solution ?
"My" solution could be easier if there was an event "BeforePageChange".
Both are a little bit complex indeed.

Louis
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby Tom Moran » Fri Mar 26, 2010 7:05 pm

Hi Louis:

The easiest way I've found to edit a multipage document is to convert/copy it to a multipage TIFF. I added a multi undo/redo feature that allows you to make changes on the page that is being displayed. When you navigate to a new page, however, those changes become a permanent part of the multipage tiff you're editing. Using this method you can navigate through your document like a viewer and edit, insert, swap, delete, add pages, etc. Once you're finished you then may save the Tiff to a new file name or convert it to a PDF or PDF/A file.

Tom
Tom Moran
 
Posts: 102
Joined: Thu May 24, 2007 9:41 am
Location: Phoenix, Arizona

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby Loïc » Fri Mar 26, 2010 8:56 pm

Hi There,

Tom, as always: thank you very much for your answer.

I have nothing else to add. Converting to editable multipage TIFF seems the best alternative to keep modifications easily. Then, you will be able to convert multipage tiff to multipage PDF.

With best regards,

Loïc
Loïc Carrère, support team.
www.orpalis.com
User avatar
Loïc
Site Admin
 
Posts: 4437
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby louis » Mon Mar 29, 2010 11:04 am

Tom and Loic, thanks a lot !

I have found the following code to convert pdf to tif.

Code: Select all
For nPage = 1 To oGdViewer.PageCount
    oGdViewer.DisplayFrame (nPage)

    If nPage = 1 Then
       oImaging.SetNativeImage (oImaging.CreateClonedImage(oGdViewer.GetNativeImage))
       Call oImaging.TiffSaveAsNativeMultiPage("c:\output.tif")
    Else
       Call oImaging.TiffAddToNativeMultipage(oGdViewer.GetNativeImage)
    End If
Next nPage


So, I'll choose between this solution and mine, depending on the performances and the modifications to do in the file. Because converting a file may be long if there are many pages (more than 100 for example). On the other hand, the conversion to tif is necessary if we need to add, swap or delete pages.

Louis
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby Tom Moran » Mon Mar 29, 2010 5:35 pm

Hi Louis:

Yes that's basically correct. A couple of things...

1. Be sure to lock the viewer right before your For/Next Loop:

Code: Select all
oGdViewer.LockControl = True


2. Remember to Close the new multipage Tiff and unlock the viewer right after your For/Next Loop:

Code: Select all
        oImaging.TiffCloseNativeMultiPage
                 oGdViewer.LockControl = False


And then... converting back to PDF is a piece of cake:

Code: Select all
nStat = oImaging.SaveAsPDFEx(TiffFileName, Title, Author, "", "", Creator, 0, 0, "", "")


All in all, execution is pretty fast.

Best regards,

Tom

Tom





nStat = oImaging.SaveAsPDFEx(TiffFileName)
Tom Moran
 
Posts: 102
Joined: Thu May 24, 2007 9:41 am
Location: Phoenix, Arizona

Re: Multi-pages : how to keep the changes (draw, ...) ?

Postby louis » Mon Mar 29, 2010 6:21 pm

I spoke about performances because, with big pdf files (reports with several hundred pages), I get a long time if we consider the time to draw each page (loop on DisplayFrame) and, above all, the time to create each pdf page. Until now, I made PdfNewPdf then a loop with PdfNewpage, PdfDrawImage, PdfEndPage, ... !

So, your idea seems very attractive !
I'll keep you informed when I'll make the change (with time comparison).

Louis
louis
 
Posts: 49
Joined: Tue Apr 28, 2009 6:18 pm


Return to GdPicture [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest