Clarification required for SaveOption of Save method

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
Posts: 6
Joined: Wed Jul 19 2006

Clarification required for SaveOption of Save method

Post by Jagannath »


I'm using PDF creator 2.0 which comes with the demo suite.

First I open a file which is having 9 pages. The command I use is

With CreatorRef
.Open App.Path & "\" & "Multi page_4.pdf",""
then on page 1 i create a text object called "text1".
.CurrentPage = 1
.CreateObject acObjectTypeText, "text1"

and I'm adding a few attributes also. Finally I save the file as a new one using the following code

.Save App.Path & "\" & "Multi page_5.pdf", 0

Then in another procedure I open the saved file(Testobjects.pdf). Here also I use the open method to open the file.

Now I tried another way to save the original file using the following method

.Save App.Path & "\" & "Multi page_5.pdf", 1

The file gets saved and then when opened the same file and tried the .pagecount property it showed "12" which is correct. But when I
use the following code
Set obj = .GetObjectByName("text1") I got the following runtime error.

Runtime error (-2147467259 Method "GetObjectByName" of object ‘IPDFCreativeX’ failed.

This runtime error occurs when I have saved file using SaveOption as 1 (acFileSaveView), -1 (acFileSaveDefault).

Why is this error coming?.

I need clarification of Saveoption of Save method.

Hope you are clear about the issue.

Thanks and Regards
Amyuni Team
Posts: 2799
Joined: Wed Sep 11 2002

Post by Joan »


When saving the PDF file you can choose to save it in View Only mode, Design Only mode or View and Design Mode:

acFileSaveAll : (0) Save document data and view.
The document can be viewed with any PDF viewer and retains
all design data.
acFileSaveView: (1) Save only document view.
The document can be viewed with any PDF viewer including
Amyuni PDF Creator but all design data such as database
connection, OLE objects, is lost.
acFileSaveDesign: (2) Save only document data.
The document can be opened, viewed and edited only with
the Amyuni PDF Creator. It will show as blank pages in other
acFileSaveDefault: (-1) Take the default Save option stored in the document object, ie one of the 3 options above.

I took the above from our documentation, in short when saving the document in view only mode, all the design information (including the object names) is lost so when opening the document again and trying to search for an objec by its name you will not find it, you can however search for a given text in that PDF file and you will find it. If you need to keep the objects names and other design information stored you need to save the file in view and design mode.

Hope this helps.
Post Reply