Saves a picture and optionally overlay ink to a file or blob from an InkPicture control or saves an OLE object in an OLE control or an OLE storage object in syntax 1 and syntax 2. The syntax you use depends on the type of object you want to save.
Saves the contents to a PDF document in syntax 3.
Description
Saves a picture and optionally overlay ink to a file or blob from an InkPicture control.
Applies to
InkPicture controls
Syntax
inkpicname.Save( t | b , format { , WithInk } )
Argument |
Description |
---|---|
inkpicname |
The name of the InkPicture control from which you want to save a picture. |
t |
A string containing the name and location of the file into which the picture will be saved. |
b |
The name of a blob passed by reference that will hold the picture in the control. |
format |
An integer specifying the format in which the picture is to be saved. Values are: 0 -- BMP (bitmap) 1 -- JPEG (Joint Photographic Experts Group) 2 -- GIF (Graphics Interchange Format) 3 -- TIFF (Tagged Image File Format) 4 -- PNG (Portable Network Graphics) |
WithInk (optional) |
A boolean specifying whether overlay ink should be saved with the picture. Values are: True -- overlay ink is saved with the picture (default) False -- overlay ink is not saved with the picture |
Return value
Integer. Returns 1 for success and -1 for failure.
Usage
Use the Save function to save the image in an InkPicture control to a file or blob with or without any ink annotations that have been made to it. By default, the ink is saved with the image.
Examples
The following example saves the image in an InkPicture control and its ink annotations in bitmap format into a blob, and attempts to update the image in the database:
int li_return blob lblb_ink li_return = ip_1.save(lblb_ink, 0, true) UPDATEBLOB employee SET backimage = :lbb_ink WHERE emp_id = :gi_id; IF sqlca.SQLNRows > 0 THEN COMMIT; ELSE messagebox("Update failed",sqlca.sqlerrtext) END IF
The following example saves the image in an InkControl into a GIF file without any ink annotations:
int li_return string ls_pathname, ls_filename GetFileSaveName("Save As", ls_pathname, ls_filename, "GIF") li_return = ip_1.save(ls_pathname, 2, false)
See also
Description
Saves an OLE object in an OLE control or an OLE storage object.
Syntax
oleobject.Save ( )
Return value
Integer. Returns 0 if it succeeds and one of the following negative values if an error occurs:
-1 -- Control is empty
-9 -- Other error
If oleobject is null, Save returns null.
Usage
When you save an OLE object, PowerBuilder saves it according to the current connection between it and an open storage or file. You establish an initial connection when you call the Open function. When you call SaveAs, the old connection is ended and a new connection is established with another storage or file.
When you call Save for an OLE control, PowerBuilder saves the object in the OLE control to the storage to which it is currently connected. The storage can be a storage object variable or a OLE storage file.
If the data has never been saved in the server application, so that there is no file on disk, the Save function in PowerBuilder returns an error.
When you call Save for a storage object variable, PowerBuilder saves the storage to the file, or substorage within the file, to which it is currently connected. You must have previously established a connection to an OLE storage file on disk, or a substorage within the file, either with Open or SaveAs.
When do you have to save twice?
If you create a storage object variable and then open that object in an OLE control, you need to call Save twice to write changed OLE information to disk: once to save from the object in the control to the storage, and again to save the storage to its associated file.
Examples
This example saves the object in the control ole_1 back to the storage from which it was loaded, either a storage object variable or a file on disk:
integer result result = ole_1.Save()
This example saves a storage object to its file. Olestor_1 is an instance variable of type olestorage:
integer result result = olestor_1.Save()
In a window's Open script, this code creates a storage variable ole_stor, which is declared as an instance variable, and associates it with a storage file that contains several Visio drawings. The script then opens one of the drawings into the control ole_draw. After the user activates and edits the object, the script for a Save button saves the object to the storage and then to the storage's file.
The script for the window's Open event includes:
OLEStorage stg_stor stg_stor = CREATE OLEStorage stg_stor.Open("myvisio.ole") ole_draw.Open(ole_stor, "visio_drawing1")
The script for the Save button's Clicked event is:
integer result result = ole_draw.Save() IF result = 0 THEN ole_stor.Save()
See also
Description
Saves a PDFDocument object as a PDF document.
Applies to
Syntax
objectname.Save (string fileName)
objectname.Save (string fileName, PDFStandard standard)
objectname.Save (ref blob pdfData)
objectname.Save (ref blob pdfData, PDFStandard standard)
Argument |
Description |
---|---|
objectname |
The name of the PDFDocument object in which you want to save the contents to a PDF document. |
fileName |
The name of the PDF document to be saved (including the file path). |
pdfData |
The Blob variable where the content of the PDF document will be saved. |
standard |
The PDFStandard is the enumerated data type indicating the level of PDF/A conformance. Values are:
|
Return value
Long.
Returns 1 if the function succeeds and a negative value if an error occurs. For more errors, see the Error Codes.
Usage
When the PDF document to be saved does not meet the rules of password setting (refer to the security property), the save fails. This is different from saving PDF output using PDFlib or GhostScript (depending on which one is set as the default method) by which the setting of password permission is ignored and the document is saved successfully.
When saving the contents to a PDF document using PDF/A standard, the security property is not compatible because the properties such as the password and restrictions are not supported in the PDF/A standard. These properties will be ignored and not appear in the PDF output. But there is one special case: if the imported PDF document does not meet the PDF/A standard, the save fails.
The table shows the compatibility between the supported PDF/A standards:
PDF/A standard compatibility | PDFA_1a! | PDFA_1b! | PDFA_3a! | PDFA_3b! | PDFA_3u! |
---|---|---|---|---|---|
PDFA_1a! | Yes | No | No | No | No |
PDFA_1b! | Yes | Yes | No | No | No |
PDFA_3a! | Yes | No | Yes | No | No |
PDFA_3b! | Yes | Yes | Yes | Yes | Yes |
PDFA_3u! | Yes | No | Yes | No | Yes |
Example 1
This example imports all pages of the PDF source document noannotsnoPwd.pdf and saves the contents to a new PDF document called save.pdf.
PDFDocument lpdf_doc long ll_return,ll_return1 lpdf_doc = Create PDFDocument ll_return = lpdf_doc.importpdf( "D:\noannotsnoPwd.pdf") ll_return1 = lpdf_doc.save( "D:\save.pdf") destroy lpdf_doc
Example 2
This example imports all pages of the PDF source document standard_3a.pdf and saves the contents to a new PDF document called save_3A.pdf using PDFA_3A! standard.
PDFDocument lpdf_doc long ll_return,ll_return1 lpdf_doc = Create PDFDocument //refers to compatible PDF/A input levels for various PDF/A output levels ll_return = lpdf_doc.importpdf( "D:\standard_3a.pdf") ll_return1 = lpdf_doc.save( "D:\save_3A.pdf",PDFA_3A!) destroy lpdf_doc
Example 3
This example saves the contents of the PDF document as a blob value.
PDFDocument lpdf_doc PDFPage lpdf_page PDFtext lpdf_text long ll_return,ll_return1 integer li_FileNum blob lb_data lpdf_doc = Create PDFDocument lpdf_page = Create PDFpage lpdf_text = Create PDFtext lpdf_text.content = "test pdf save blob" lpdf_text.setposition(50,100) lpdf_page.addcontent(lpdf_text) lpdf_doc.addpage(lpdf_page) ll_return = lpdf_doc.save(lb_data)
See also